[Python-checkins] python/dist/src/Lib pickle.py,1.107,1.108
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Tue, 28 Jan 2003 07:19:58 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv18102
Modified Files:
pickle.py
Log Message:
Add a few comments. Change the way the protocol is checked (it must
be one of 0, 1 or 2).
I should note that the previous checkin also added NEWOBJ support to
the unpickler -- but there's nothing yet that generates this.
Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.107
retrieving revision 1.108
diff -C2 -d -r1.107 -r1.108
*** pickle.py 28 Jan 2003 15:10:22 -0000 1.107
--- pickle.py 28 Jan 2003 15:19:53 -0000 1.108
***************
*** 159,162 ****
--- 159,165 ----
_quotes = ["'", '"']
+
+ # Pickling machinery
+
class Pickler:
***************
*** 179,187 ****
"""
! if not 0 <= proto <= 2:
raise ValueError, "pickle protocol must be 0, 1 or 2"
self.write = file.write
self.memo = {}
! self.proto = proto
self.bin = proto >= 1
--- 182,190 ----
"""
! if proto not in (0, 1, 2):
raise ValueError, "pickle protocol must be 0, 1 or 2"
self.write = file.write
self.memo = {}
! self.proto = int(proto)
self.bin = proto >= 1
***************
*** 640,643 ****
--- 643,647 ----
dispatch[TypeType] = save_global
+ # Pickling helpers
def _keep_alive(x, memo):
***************
*** 683,686 ****
--- 687,692 ----
return name
+
+ # Unpickling machinery
class Unpickler: