mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
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.
This commit is contained in:
parent
e3d9bd6be3
commit
9243a4b933
3 changed files with 34 additions and 2 deletions
|
@ -1625,7 +1625,11 @@ PyThreadState_Clear(PyThreadState *tstate)
|
|||
{
|
||||
assert(tstate->_status.initialized && !tstate->_status.cleared);
|
||||
assert(current_fast_get()->interp == tstate->interp);
|
||||
assert(!_PyThreadState_IsRunningMain(tstate));
|
||||
// GH-126016: In the _interpreters module, KeyboardInterrupt exceptions
|
||||
// during PyEval_EvalCode() are sent to finalization, which doesn't let us
|
||||
// mark threads as "not running main". So, for now this assertion is
|
||||
// disabled.
|
||||
// XXX assert(!_PyThreadState_IsRunningMain(tstate));
|
||||
// XXX assert(!tstate->_status.bound || tstate->_status.unbound);
|
||||
tstate->_status.finalizing = 1; // just in case
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue