mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
[3.12] gh-126489: Do not call persistent_id() for a persistent id in Python pickle (GH-126490) (GH-126516)
(cherry picked from commit 8fa4dc4ba8)
This commit is contained in:
parent
97ab3cf374
commit
a19832bfbf
2 changed files with 8 additions and 4 deletions
|
|
@ -533,10 +533,11 @@ def save(self, obj, save_persistent_id=True):
|
|||
self.framer.commit_frame()
|
||||
|
||||
# Check for persistent id (defined by a subclass)
|
||||
pid = self.persistent_id(obj)
|
||||
if pid is not None and save_persistent_id:
|
||||
self.save_pers(pid)
|
||||
return
|
||||
if save_persistent_id:
|
||||
pid = self.persistent_id(obj)
|
||||
if pid is not None:
|
||||
self.save_pers(pid)
|
||||
return
|
||||
|
||||
# Check the memo
|
||||
x = self.memo.get(id(obj))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
The Python implementation of :mod:`pickle` no longer calls
|
||||
:meth:`pickle.Pickler.persistent_id` for the result of
|
||||
:meth:`!persistent_id`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue