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
97394bc7
Commit
97394bc7
authored
May 21, 2002
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch 533291. Deprecate None return form of __reduce__.
parent
7f7d5bf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
Doc/lib/libpickle.tex
Doc/lib/libpickle.tex
+8
-4
Lib/pickle.py
Lib/pickle.py
+4
-0
No files found.
Doc/lib/libpickle.tex
View file @
97394bc7
...
...
@@ -444,6 +444,7 @@ or three, with the following semantics:
by name.
\item
A tuple of arguments for the callable object, or
\code
{
None
}
.
\deprecated
{
2.3
}{
Use the tuple of arguments instead
}
\item
Optionally, the object's state, which will be passed to
the object's
\method
{__
setstate
__
()
}
method as described in
...
...
@@ -456,10 +457,13 @@ or three, with the following semantics:
Upon unpickling, the callable will be called (provided that it meets
the above criteria), passing in the tuple of arguments; it should
return the unpickled object. If the second item was
\code
{
None
}
, then
instead of calling the callable directly, its
\method
{__
basicnew
__
()
}
method is called without arguments. It should also return the
unpickled object.
return the unpickled object.
If the second item was
\code
{
None
}
, then instead of calling the
callable directly, its
\method
{__
basicnew
__
()
}
method is called
without arguments. It should also return the unpickled object.
\deprecated
{
2.3
}{
Use the tuple of arguments instead
}
An alternative to implementing a
\method
{__
reduce
__
()
}
method on the
object to be pickled, is to register the callable with the
...
...
Lib/pickle.py
View file @
97394bc7
...
...
@@ -862,6 +862,10 @@ class Unpickler:
"unpickling"
%
callable
if
arg_tup
is
None
:
import
warnings
warnings
.
warn
(
"The None return argument form of __reduce__ is "
"deprecated. Return a tuple of arguments instead."
,
DeprecationWarning
)
value
=
callable
.
__basicnew__
()
else
:
value
=
apply
(
callable
,
arg_tup
)
...
...
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