Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
795ea89c
Commit
795ea89c
authored
Feb 03, 2003
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support keyword argument 'bin', with a pending deprecation warning.
parent
31f119eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
Lib/pickle.py
Lib/pickle.py
+13
-5
No files found.
Lib/pickle.py
View file @
795ea89c
...
...
@@ -167,7 +167,7 @@ del x
class
Pickler
:
def
__init__
(
self
,
file
,
proto
=
0
):
def
__init__
(
self
,
file
,
proto
=
None
,
bin
=
None
):
"""This takes a file-like object for writing a pickle data stream.
The optional proto argument tells the pickler to use the given
...
...
@@ -191,6 +191,14 @@ class Pickler:
object, or any other custom object that meets this interface.
"""
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
elif
proto
not
in
(
0
,
1
,
2
):
...
...
@@ -1464,12 +1472,12 @@ try:
except
ImportError
:
from
StringIO
import
StringIO
def
dump
(
obj
,
file
,
proto
=
0
):
Pickler
(
file
,
proto
).
dump
(
obj
)
def
dump
(
obj
,
file
,
proto
=
None
,
bin
=
None
):
Pickler
(
file
,
proto
,
bin
).
dump
(
obj
)
def
dumps
(
obj
,
proto
=
0
):
def
dumps
(
obj
,
proto
=
None
,
bin
=
None
):
file
=
StringIO
()
Pickler
(
file
,
proto
).
dump
(
obj
)
Pickler
(
file
,
proto
,
bin
).
dump
(
obj
)
return
file
.
getvalue
()
def
load
(
file
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment