[Python-checkins] python/dist/src/Lib pickle.py,1.100,1.101
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Mon, 27 Jan 2003 19:51:38 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv26041/Lib
Modified Files:
pickle.py
Log Message:
save_inst(): Rewrote to have only one branch on self.bin. Also got rid
of my recent XXX comment, taking a (what appears to be vanishingly small)
chance and calling self.memoize() instead.
Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.100
retrieving revision 1.101
diff -C2 -d -r1.100 -r1.101
*** pickle.py 28 Jan 2003 03:49:52 -0000 1.100
--- pickle.py 28 Jan 2003 03:51:36 -0000 1.101
***************
*** 552,556 ****
def save_inst(self, object):
- d = id(object)
cls = object.__class__
--- 552,555 ----
***************
*** 570,590 ****
if self.bin:
save(cls)
!
! for arg in args:
! save(arg)
!
! # This method does not use memoize() so that it can handle
! # the special case for non-binary mode.
! # XXX What did that comment mean? That is, what "special case for
! # XXX non-binary mode"? It sure *looks* like nothing special is
! # XXX happening in the INST case.
! memo_len = len(memo)
! if self.bin:
! write(OBJ + self.put(memo_len))
else:
! write(INST + cls.__module__ + '\n' + cls.__name__ + '\n' +
! self.put(memo_len))
! memo[d] = (memo_len, object)
try:
--- 569,581 ----
if self.bin:
save(cls)
! for arg in args:
! save(arg)
! write(OBJ)
else:
! for arg in args:
! save(arg)
! write(INST + cls.__module__ + '\n' + cls.__name__ + '\n')
! self.memoize(object)
try:
***************
*** 597,600 ****
--- 588,592 ----
save(stuff)
write(BUILD)
+
dispatch[InstanceType] = save_inst
***************
*** 627,630 ****
--- 619,623 ----
write(GLOBAL + module + '\n' + name + '\n')
self.memoize(object)
+
dispatch[ClassType] = save_global
dispatch[FunctionType] = save_global