-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Python implementation of pickle calls persistent_id() for a persistent id #126489
Comments
serhiy-storchaka
added
type-bug
An unexpected behavior, bug, or error
3.12
bugs and security fixes
3.13
bugs and security fixes
3.14
new features, bugs and security fixes
labels
Nov 6, 2024
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Nov 6, 2024
serhiy-storchaka
added a commit
that referenced
this issue
Nov 6, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 6, 2024
…ython pickle (pythonGH-126490) (cherry picked from commit 8fa4dc4) Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Nov 6, 2024
…id in Python pickle (pythonGH-126490) (cherry picked from commit 8fa4dc4) Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka
added a commit
that referenced
this issue
Nov 6, 2024
…Python pickle (GH-126490) (GH-126514) (cherry picked from commit 8fa4dc4) Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka
added a commit
that referenced
this issue
Nov 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Pickle allows to define the
persistent_id()
method in thePickler
class. If it is defined, it is called for every pickled object, and its result will be pickled instead if it is not None. In the Python implementationpersistent_id()
is also called for the result ofpersistent_id()
, but the result of the second call is ignored. The C implementation only callspersistent_id()
once. Calling it twice is just a waste of time in best case, and can have other negative impact (for example if reference for every object for which it was called is stored), so I consider it a bug.It was found during work on #125752.
Linked PRs
The text was updated successfully, but these errors were encountered: