mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Removed the deprecated bin parameter from the pickle module.
This commit is contained in:
parent
4ebe364277
commit
3489cad30a
3 changed files with 18 additions and 45 deletions
|
@ -171,7 +171,7 @@ del x
|
|||
|
||||
class Pickler:
|
||||
|
||||
def __init__(self, file, protocol=None, bin=None):
|
||||
def __init__(self, file, protocol=None):
|
||||
"""This takes a file-like object for writing a pickle data stream.
|
||||
|
||||
The optional protocol argument tells the pickler to use the
|
||||
|
@ -195,12 +195,6 @@ class Pickler:
|
|||
object, or any other custom object that meets this interface.
|
||||
|
||||
"""
|
||||
if protocol is not None and bin is not None:
|
||||
raise ValueError, "can't specify both 'protocol' and 'bin'"
|
||||
if bin is not None:
|
||||
warnings.warn("The 'bin' argument to Pickler() is deprecated",
|
||||
DeprecationWarning)
|
||||
protocol = bin
|
||||
if protocol is None:
|
||||
protocol = 0
|
||||
if protocol < 0:
|
||||
|
@ -1378,12 +1372,12 @@ try:
|
|||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
def dump(obj, file, protocol=None, bin=None):
|
||||
Pickler(file, protocol, bin).dump(obj)
|
||||
def dump(obj, file, protocol=None):
|
||||
Pickler(file, protocol).dump(obj)
|
||||
|
||||
def dumps(obj, protocol=None, bin=None):
|
||||
def dumps(obj, protocol=None):
|
||||
file = StringIO()
|
||||
Pickler(file, protocol, bin).dump(obj)
|
||||
Pickler(file, protocol).dump(obj)
|
||||
return file.getvalue()
|
||||
|
||||
def load(file):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue