gh-151763: Fix dealloc clears the in-flight exception in subtype_dealloc#153548
Open
Abhi210 wants to merge 4 commits into
Open
gh-151763: Fix dealloc clears the in-flight exception in subtype_dealloc#153548Abhi210 wants to merge 4 commits into
Abhi210 wants to merge 4 commits into
Conversation
…ythonGH-153549) Correct inaccurate return-type and option descriptions in the tkinter reference, and add missing module and class docstrings. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…ompilers (pythonGH-153543) The check assigned the addresses of Tcl_Init() and Tk_Init() to unused variables, which optimizing compilers can eliminate, so it linked even when the libraries were missing. Call the functions instead. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…eds Tk 9.0 (pythonGH-153556) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #gh-151763 OOM-0023
subtype_dealloc()can clear the in-flight exception while tearing down heap-type instances. Unlike slot_tp_finalize(), this deallocation path does not preserve the current exception across operations that may perform arbitrary Py_DECREFs, potentially causingtstate->current_exceptionto be lost.This patch saves the current exception before the destructive teardown (clear_slots(), managed dict clearing, base deallocation, and type decref) and restores it afterward, mirroring the existing exception-preservation pattern used in slot_tp_finalize().