]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-126016: Remove bad assertion in `PyThreadState_Clear` (GH-139158)
authorPeter Bierma <zintensitydev@gmail.com>
Fri, 19 Sep 2025 12:17:05 +0000 (08:17 -0400)
committerGitHub <noreply@github.com>
Fri, 19 Sep 2025 12:17:05 +0000 (12:17 +0000)
commit9243a4b93397f04237a5112011ee03433eda0462
tree66bb0e76d210c5751919571492019bb814530f44
parente3d9bd6be384e8a0ae95f298747c90ef3260d12b
gh-126016: Remove bad assertion in `PyThreadState_Clear` (GH-139158)

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.
Lib/test/test_interpreters/test_api.py
Misc/NEWS.d/next/Library/2025-09-19-07-41-52.gh-issue-126016.Uz9W6h.rst [new file with mode: 0644]
Python/pystate.c