This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients corona10, serhiy.storchaka, shihai1991, vstinner
Date 2020-09-15.20:10:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:45serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, corona10, shihai1991
2020-09-15 20:10:45serhiy.storchakasetmessageid: <>
2020-09-15 20:10:45serhiy.storchakalinkissue41052 messages
2020-09-15 20:10:45serhiy.storchakacreate