-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support pickling of super object #125767
Labels
type-feature
A feature request or enhancement
Comments
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Oct 21, 2024
Previously, copying a super object returned a copy of the instance invoking super(). Pickling a super object could pickle the instance invoking super() or fail, depending on its type and protocol. Now deep copying returns a new super object and pickling pickles the super object. Shallow copying returns the same super object.
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Oct 21, 2024
Previously, copying a super object returned a copy of the instance invoking super(). Pickling a super object could pickle the instance invoking super() or fail, depending on its type and protocol. Now deep copying returns a new super object and pickling pickles the super object. Shallow copying returns the same super object.
serhiy-storchaka
added a commit
that referenced
this issue
Oct 21, 2024
Previously, copying a super object returned a copy of the instance invoking super(). Pickling a super object could pickle the instance invoking super() or fail, depending on its type and protocol. Now deep copying returns a new super object and pickling pickles the super object. Shallow copying returns the same super object.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature or enhancement
As was noted in #125714 (comment), the
super
object is not pickleable. For example:Produces a traceback:
This is because the special methods like
__reduce_ex__()
are looked up in an instance and translated to a lookup in the underlying object.This cannot be solved by implementing the
__reduce_ex__()
method in thesuper
class, because the current behavior is expected whensuper()
is used in the__reduce_ex__()
implementation of some subclass. Thesuper
class likely should be registered in the global dispatch table.There may be similar issue with shallow and deep copying.
Linked PRs
The text was updated successfully, but these errors were encountered: