-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
gh-116946: fully implement GC protocol for lzma
objects
#138288
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, @picnixz, I could not cleanly backport this to
|
…onGH-138288) (cherry picked from commit 3ea16f9) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
GH-138321 is a backport of this pull request to the 3.14 branch. |
pythonGH-138288) (cherry picked from commit 3ea16f9) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
GH-138323 is a backport of this pull request to the 3.13 branch. |
…` objects (pythonGH-138288) (python#138323)" This reverts commit 828682d.
…ts (python#138288)" This reverts commit 3ea16f9.
…H-138322, GH-138323, GH-138326) (#138337) * Revert "[3.13] gh-116946: fully implement GC protocol for `bz2` objects (GH-138266) (#138322)" This reverts commit 90036f5. * Revert "[3.13] gh-116946: fully implement GC protocol for `lzma` objects (GH-138288) (#138323)" This reverts commit 828682d. * Revert "[3.13] gh-116946: fully implement GC protocol for `_hashlib` objects (GH-138289) (#138326)" This reverts commit 21b5932.
…, GH-138288, GH-138289) (#138338) * Revert "gh-116946: fully implement GC protocol for `bz2` objects (#138266)" This reverts commit 9be91f6. * Revert "gh-116946: fully implement GC protocol for `lzma` objects (#138288)" This reverts commit 3ea16f9. * Revert "gh-116946: fully implement GC protocol for `_hashlib` objects (#138289)" This reverts commit 6f1dd95.
…ythonGH-138266, pythonGH-138288, pythonGH-138289) (python#138338) * Revert "pythongh-116946: fully implement GC protocol for `bz2` objects (python#138266)" This reverts commit 9be91f6. * Revert "pythongh-116946: fully implement GC protocol for `lzma` objects (python#138288)" This reverts commit 3ea16f9. * Revert "pythongh-116946: fully implement GC protocol for `_hashlib` objects (python#138289)" This reverts commit 6f1dd95.
Outdated conversation
@ZeroIntensity Using
tp_alloc
directly feels wrong to me even because it's about relying on implementation details that are not documented (and not explicitly recommended by our docs recommend), while usingPyObject_GC_New
forces me to actually memset the structure (with an additional offset!) as otherwise I need to initialize the fields manually (this is essentially to prevent a segfault when invoking the (external) LZMA interface).So I really think we should have some
PyObject_GC_New
-like function that zeroes the remaining fields or a just a function for zeroing the rest of a PyObject fields, that is:and that we also have a private constant indicating the size of
PyObject_HEAD
. WDYT?EDIT: I was looking at the 3.13 docs but the recommendations were given in the 3.14 docs, which is why I missed them.