-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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-105375: Explicitly initialise all {Pickler,Unpickler}Object fields #105686
Conversation
…fields PyObject_GC_New() only initialises the object header. All other fields must be explicitly initialised to prevent manipulation of uninitialised fields in dealloc. Align initialisation order with the layout of the object structs.
- Prepare memory allocations and new objects before calling PyObject_GC_New() - Initialise all fields at once using a series of assignments only - Use error labels for clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it is enough to set output_buffer = NULL
.
You also need to adjust |
Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Sorry, @erlend-aasland, I could not cleanly backport this to |
GH-105710 is a backport of this pull request to the 3.12 branch. |
…fields (pythonGH-105686) All fields must be explicitly initialised to prevent manipulation of uninitialised fields in dealloc. Align initialisation order with the layout of the object structs. (cherry picked from commit ca3cc4b) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
…Object fields (python#105686) All fields must be explicitly initialised to prevent manipulation of uninitialised fields in dealloc. Align initialisation order with the layout of the object structs. (cherry picked from commit ca3cc4b) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
GH-105711 is a backport of this pull request to the 3.11 branch. |
Thanks for the review! |
… fields (GH-105686) (#105710) All fields must be explicitly initialised to prevent manipulation of uninitialised fields in dealloc. Align initialisation order with the layout of the object structs. (cherry picked from commit ca3cc4b) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* main: pythongh-105540: Fix code generator tests (python#105707) pythongh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields (python#105686) pythongh-105331: Change `asyncio.sleep` to raise ``ValueError` for nan (python#105641) Remove support for legacy bytecode instructions (python#105705)
… fields (#105686) (#105711) * [3.11] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields (#105686) All fields must be explicitly initialised to prevent manipulation of uninitialised fields in dealloc. Align initialisation order with the layout of the object structs. (cherry picked from commit ca3cc4b) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
PyObject_GC_New() only initialises the object header. All other fields
must be explicitly initialised to prevent manipulation of uninitialised
fields in dealloc.
Align initialisation order with the layout of the object structs.