Staging
v0.5.1
https://github.com/python/cpython
Revision d1f4984a9bb2e90d4fc473be1a169917277efa4d authored by Guido van Rossum on 10 December 1997, 23:40:18 UTC, committed by Guido van Rossum on 10 December 1997, 23:40:18 UTC
The attached patch adds the following behavior to the handling
of REDUCE codes:

- A user-defined type may have a __reduce__ method that returns
  a string rather than a tuple, in which case the object is
  saved as a global object with a name given by the string returned
  by reduce.

  This was a feature added to cPickle a long time ago.


- User-defined types can now support unpickling without
  executing a constructor.

  The second value returned from '__reduce__' can now be None,
  rather than an argument tuple.  On unpickling, if the
  second value returned from '__reduce__' during pickling was
  None, then rather than calling the first value returned from
  '__reduce__', directly, the '__basicnew__' method of the
  first value returned from '__reduce__' is called without
  arguments.

I also got rid of a few of Chris' extra ()s, which he used
to make python ifs look like C ifs.
1 parent 79f016a
History
Tip revision: d1f4984a9bb2e90d4fc473be1a169917277efa4d authored by Guido van Rossum on 10 December 1997, 23:40:18 UTC
Jim Fulton writes:
Tip revision: d1f4984
File Mode Size
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
Tools
.hgtags -rw-r--r-- 1.0 KB
Makefile.in -rw-r--r-- 16.2 KB
README -rw-r--r-- 36.9 KB
acconfig.h -rw-r--r-- 2.7 KB
config.h.in -rw-r--r-- 9.9 KB
configure -rwxr-xr-x 113.3 KB
configure.in -rw-r--r-- 17.4 KB
install-sh -rwxr-xr-x 2.1 KB

README

back to top