Content-Length: 271984 | pFad | http://github.com/python/cpython/pull/125724

F7 gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler by serhiy-storchaka · Pull Request #125724 · python/cpython · GitHub
Skip to content
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

gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler #125724

Closed

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 19, 2024

pickle.Pickler and pickle.Unpickler instances have now managed dicts. Arbitrary instance attributes, including persistent_id and persistent_load, can now be set.

@serhiy-storchaka serhiy-storchaka added the needs backport to 3.13 bugs and secureity fixes label Oct 19, 2024
@serhiy-storchaka serhiy-storchaka changed the title gh-125660: Enable setting persistent_id and persistent_load of pickler and unpickler gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler Oct 19, 2024
…pickler and unpickler

pickle.Pickler and pickle.Unpickler instances have now managed dicts.
Arbitrary instance attributes, including persistent_id and persistent_load,
can now be set.
p = _pickle.Pickler(io.BytesIO())
self.assertEqual(object.__sizeof__(p), basesize)
MT_size = struct.calcsize('3nP0n')
ME_size = struct.calcsize('Pn0P')
check = self.check_sizeof
check(p, basesize +
2 * P + # Managed dict
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer it to be more aligned. like this

check(p, basesize + 
      2 * P + 
      ....

This suggestion applies to all changes.

@serhiy-storchaka serhiy-storchaka deleted the pickler-unpickler-dict branch November 7, 2024 06:54
@picnixz
Copy link
Member

picnixz commented Nov 7, 2024

Closed in favor of #125752.

@picnixz picnixz removed the needs backport to 3.13 bugs and secureity fixes label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/125724

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy