[Python-checkins] python/dist/src/Lib pickle.py,1.152,1.153

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2003年2月14日 19:01:45 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv13821/python/Lib
Modified Files:
	pickle.py 
Log Message:
cPickle.c, load_build(): Taught cPickle how to pick apart
the optional proto 2 slot state.
pickle.py, load_build(): CAUTION: Noted that cPickle's
load_build and pickle's load_build really don't do the same
things with the state, and didn't before this patch either.
cPickle never tries to do .update(), and has no backoff if
instance.__dict__ can't be retrieved. There are no tests
that can tell the difference, and part of what cPickle's
load_build() did looked accidental to me, so I don't know
what the true intent is here.
pickletester.py, test_pickle.py: Got rid of the hack for
exempting cPickle from running some of the proto 2 tests.
dictobject.c, PyDict_Next(): documented intended use.
Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.152
retrieving revision 1.153
diff -C2 -d -r1.152 -r1.153
*** pickle.py	13 Feb 2003 15:44:39 -0000	1.152
--- pickle.py	15 Feb 2003 03:01:08 -0000	1.153
***************
*** 1250,1253 ****
--- 1250,1257 ----
 # difference when unpickling in restricted
 # vs. unrestricted modes.
+ # Note, however, that cPickle has never tried to do the
+ # .update() business, and always uses
+ # PyObject_SetItem(inst.__dict__, key, value) in a
+ # loop over state.items().
 for k, v in state.items():
 setattr(inst, k, v)

AltStyle によって変換されたページ (->オリジナル) /