summaryrefslogtreecommitdiffstats
path: root/Lib/copy_reg.py
Commit message (Collapse)AuthorAgeFilesLines
* _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