Skip to content

gh-126016: Remove bad assertion in PyThreadState_Clear - #139158

Merged
ZeroIntensity merged 4 commits into
python:mainfrom
ZeroIntensity:subinterp-running-main
Sep 19, 2025
Merged

gh-126016: Remove bad assertion in PyThreadState_Clear#139158
ZeroIntensity merged 4 commits into
python:mainfrom
ZeroIntensity:subinterp-running-main

Conversation

@ZeroIntensity

@ZeroIntensityZeroIntensity commented Sep 19, 2025

Copy link
Copy Markdown
Member

In the _interpreters module, we use PyEval_EvalCode to run Python code in another interpreter. However, when the process receives a KeyboardInterrupt, PyEval_EvalCode will jump straight to finalization rather than returning. This prevents us from cleaning up and marking the thread as "not running main", which triggers an assertion in PyThreadState_Clear on debug builds. Since everything else works as intended, remove that assertion.

@ZeroIntensityZeroIntensity changed the title gh-126016: Remove assertion in PyThreadState_Cleargh-126016: Remove bad assertion in PyThreadState_ClearSep 19, 2025

@ericsnowcurrentlyericsnowcurrently left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Thanks for doing this.

@github-project-automationgithub-project-automationBot moved this from Todo to In Progress in SprintSep 19, 2025
@ZeroIntensityZeroIntensity added needs backport to 3.14 bugs and security fixes and removed needs backport to 3.14 bugs and security fixes labels Sep 19, 2025
@ZeroIntensity
ZeroIntensity enabled auto-merge (squash) September 19, 2025 12:06
@ZeroIntensity
ZeroIntensity merged commit 9243a4b into python:mainSep 19, 2025
59 checks passed
@ZeroIntensity
ZeroIntensity deleted the subinterp-running-main branch September 19, 2025 12:17
@github-project-automationgithub-project-automationBot moved this from In Progress to Done in SprintSep 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants

@ZeroIntensity@ericsnowcurrently