summaryrefslogtreecommitdiffstats
path: root/Lib/copy_reg.py
Commit message (Collapse)AuthorAgeFilesLines
* Revert previous checkin and just add a comment about constructor_ob.Jeremy Hylton2003-06-271-3/+5
| | | | | There's no point to passing it anymore, but there's a test that expects the call to fail if you pass a non-callable object.
* Don't call constructor() from pickle().Jeremy Hylton2003-06-261-3/+3
| | | | | | | The constructor() call only made sense when it registered the constructor as safe for unpickling. We should probably remove the module-global function, but need to worry about backwards compatibility.
* Patch #750595: Refer to type complex using builtin. Fixes #595837.Martin v. Löwis2003-06-071-3/+9
| | | | Backported to 2.2.
* Remove _reduce_2, it's now implemented in C.Guido van Rossum2003-02-211-42/+5
|
* Rename _better_reduce to _reduce_2, to make sure that any code thatGuido van Rossum2003-02-191-10/+5
| | | | | was still referencing it will fail. Also removed some debug cruft from _reduce_ex.
* Use __reduce_ex__ in copy.py. The test_*copy_cant() tests are simpler again.Guido van Rossum2003-02-191-3/+8
|
* Introducing __reduce_ex__, which is called with a protocol number argumentGuido van Rossum2003-02-181-0/+11
| | | | | if it exists in preference over __reduce__. Now Tim can go implement this in cPickle.c.
* SF patch #685738 by Michael Stone.Guido van Rossum2003-02-131-3/+6
| | | | | | | This changes the default __new__ to refuse arguments iff tp_init is the default __init__ implementation -- thus making it a TypeError when you try to pass arguments to a constructor if the class doesn't override at least __init__ or __new__.
* Get rid of the "bozo" __getstate__ that was inserted when __slots__Guido van Rossum2003-02-101-10/+5
| | | | | | was used. This simplifies some logic in copy_reg.py (used by pickling). It also broke a test, but this was rewritten to test the new feature. :-)
* Reserve a range for Zope, not specifically for Zope 3.Guido van Rossum2003-02-071-1/+1
|
* Move _better_reduce from copy.py to copy_reg.py, and also use it inGuido van Rossum2003-02-061-0/+78
| | | | pickle.py, where it makes save_newobj() unnecessary. Tests pass.
* cPickle can load pickles using proto 2 EXT[124] now, but can't yetTim Peters2003-02-041-1/+1
| | | | generate these opcodes.
* Rename the extension registry variables to have leading underscores --Guido van Rossum2003-02-041-18/+18
| | | | | | | | | this clarifies that they are part of an internal API (albeit shared between pickle.py, copy_reg.py and cPickle.c). I'd like to do the same for copy_reg.dispatch_table, but worry that it might be used by existing code. This risk doesn't exist for the extension registry.
* Brought some module variables into synch with pickle.py's current values.Tim Peters2003-02-041-0/+2
| | | | | Imported the extension-registry dicts from copy_reg.py, in preparation for tackling EXT[124].
* Removed all uses of the out-of-favor __safe_for_unpickling__ magicTim Peters2003-02-011-3/+0
| | | | attr, and copy_reg.safe_constructors.
* Add extension management to __all__.Guido van Rossum2003-01-311-1/+2
|
* Support for extension codes. (By accident I checked in the tests first.)Guido van Rossum2003-01-291-0/+59
|
* _reduce(): Avoid infinite recursion in the pickler when self.__class__Guido van Rossum2001-12-271-0/+2
| | | | | | | | doesn't have the _HEAPTYPE flag set, e.g. for time.struct_time and posix.stat_result. This fixes the immediate symptoms of SF bug #496873 (cPickle / time.struct_time loop), replacing the infinite loop with an exception.
* _reduce():Guido van Rossum2001-11-241-3/+8
| | | | | | | | | | | | - Fix for SF bug #482752: __getstate__ & __setstate__ ignored (by Anon.) In fact, only __getstate__ isn't recognized. This fixes that. - Separately, the test for base.__flags__ & _HEAPTYPE raised an AttributeError exception when a classic class was amongst the bases. Fixed this with a hasattr() bandaid (classic classes never qualify as the "hard" base class anyway, which is what the code is trying to find).
* Changes to copy() and deepcopy() in copy.py to support __reduce__ as aGuido van Rossum2001-09-281-1/+9
| | | | | | | | | | fallback for objects that are neither supported by our dispatch table nor have a __copy__ or __deepcopy__ method. Changes to _reduce() in copy_reg.py to support reducing objects that don't have a __dict__ -- copy.copy(complex()) now invokes _reduce(). Add tests for copy.copy() and copy.deepcopy() to test_regrtest.py.
* _reconstructor(): there's no need for tricks with assignment toGuido van Rossum2001-09-251-9/+2
| | | | | __class__. The __new__ protocol is up to this. (Thanks to Tim for pointing this out.)
* - Provisional support for pickling new-style objects. (*)Guido van Rossum2001-09-251-0/+29
| | | | | | | | | | | | | | | | | | | - Made cls.__module__ writable. - Ensure that obj.__dict__ is returned as {}, not None, even upon first reference; it simply springs into life when you ask for it. (*) The pickling support is provisional for the following reasons: - It doesn't support classes with __slots__. - It relies on additional support in copy_reg.py: the C method __reduce__, defined in the object class, really calls calling copy_reg._reduce(obj). Eventually the Python code in copy_reg.py needs to be migrated to C, but I'd like to experiment with the Python implementation first. The _reduce() code also relies on an additional helper function, _reconstructor(), defined in copy_reg.py; this should also be reimplemented in C.
* added __all__ lists to a number of Python modulesSkip Montanaro2001-01-201-0/+2
| | | | | | | | added test script and expected output file as well this closes patch 103297. __all__ attributes will be added to other modules without first submitting a patch, just adding the necessary line to the test script to verify more-or-less correct implementation.
* In the module docstring, clarify that this is used to register pickleFred Drake2000-10-111-3/+15
| | | | | | | | | | | support for extension types, not classes. pickle(): If the type is a class or if the reduction function is not callable, raise a TypeError. constructor(): If the constructor is not callable, raise TypeError. This (partially) closes SourceForge patch #101859.
* Mass patch by Ka-Ping Yee:Guido van Rossum2000-02-021-1/+1
| | | | | | | | | | | 1. Comments at the beginning of the module, before functions, and before classes have been turned into docstrings. 2. Tabs are normalized to four spaces. Also, removed the "remove" function from dircmp.py, which reimplements list.remove() (it must have been very old).
* Added some minimal comments and tweaked lay-out a bit.Guido van Rossum1997-05-201-3/+7
|
* support module for cPickleGuido van Rossum1997-04-091-0/+17