Message376951
There are other heap types implemented in C in the stdlib and third-party libraries for which pickling with protocols 0 and 1 works incorrectly. It would be better to fix copyreg._reduce_ex() instead of disabling pickling for these types one by one.
From PEP 307:
> Let D be the class on the object to be pickled. First, find the nearest base class that is implemented in C (either as a built-in type or as a type defined by an extension class). Call this base class B, and the class of the object to be pickled D. Unless B is the class 'object', instances of class B must be picklable, either by having built-in support (as defined in the above three bullet points), or by having a non-default __reduce__ implementation. B must not be the same class as D (if it were, it would mean that D is not implemented in Python).
The problem is with determining which class is implemented in C. The current code implies that heap types are implemented in Python, and static types are implemented in C. It is not always true, because some heap types can be implemented in C. |
|
Date |
User |
Action |
Args |
2020-09-15 20:10:45 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, vstinner, corona10, shihai1991 |
2020-09-15 20:10:45 | serhiy.storchaka | set | messageid: <1600200645.27.0.900345807129.issue41052@roundup.psfhosted.org> |
2020-09-15 20:10:45 | serhiy.storchaka | link | issue41052 messages |
2020-09-15 20:10:45 | serhiy.storchaka | create | |
|