[Python-checkins] python/dist/src/Lib pickle.py,1.140,1.141
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Mon, 03 Feb 2003 08:59:54 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv19418
Modified Files:
pickle.py
Log Message:
Support keyword argument 'bin', with a pending deprecation warning.
Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.140
retrieving revision 1.141
diff -C2 -d -r1.140 -r1.141
*** pickle.py 2 Feb 2003 20:29:38 -0000 1.140
--- pickle.py 3 Feb 2003 16:59:48 -0000 1.141
***************
*** 168,172 ****
class Pickler:
! def __init__(self, file, proto=0):
"""This takes a file-like object for writing a pickle data stream.
--- 168,172 ----
class Pickler:
! def __init__(self, file, proto=None, bin=None):
"""This takes a file-like object for writing a pickle data stream.
***************
*** 192,195 ****
--- 192,203 ----
"""
+ if proto is not None and bin is not None:
+ raise ValueError, "can't specify both 'proto' and 'bin' arguments"
+ if bin is not None:
+ warnings.warn("The 'bin' argument to Pickler() is deprecated",
+ PendingDeprecationWarning)
+ proto = bin
+ if proto is None:
+ proto = 0
if proto < 0:
proto = 2
***************
*** 1465,1474 ****
from StringIO import StringIO
! def dump(obj, file, proto=0):
! Pickler(file, proto).dump(obj)
! def dumps(obj, proto=0):
file = StringIO()
! Pickler(file, proto).dump(obj)
return file.getvalue()
--- 1473,1482 ----
from StringIO import StringIO
! def dump(obj, file, proto=None, bin=None):
! Pickler(file, proto, bin).dump(obj)
! def dumps(obj, proto=None, bin=None):
file = StringIO()
! Pickler(file, proto, bin).dump(obj)
return file.getvalue()