Skip to content

gh-151763: Fix dealloc clears the in-flight exception in subtype_dealloc#153548

Open
Abhi210 wants to merge 4 commits into
python:mainfrom
Abhi210:gh-151763-0023
Open

gh-151763: Fix dealloc clears the in-flight exception in subtype_dealloc#153548
Abhi210 wants to merge 4 commits into
python:mainfrom
Abhi210:gh-151763-0023

Conversation

@Abhi210

@Abhi210 Abhi210 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

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 causing tstate->current_exception to 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().

@Abhi210 Abhi210 changed the title BUG: Fix dealloc clears the in-flight exception in subtype_dealloc gh-151763: Fix dealloc clears the in-flight exception in subtype_dealloc Jul 11, 2026
@Abhi210 Abhi210 marked this pull request as ready for review July 11, 2026 09:57
@Abhi210 Abhi210 requested a review from markshannon as a code owner July 11, 2026 09:57
serhiy-storchaka and others added 3 commits July 11, 2026 17:45
…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>
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.

2 participants