gh-121058: Warn if PyThreadState_Clear is called with an exception set (gh-121343)
This commit is contained in:
@@ -1649,6 +1649,11 @@ PyThreadState_Clear(PyThreadState *tstate)
|
||||
"PyThreadState_Clear: warning: thread still has a frame\n");
|
||||
}
|
||||
|
||||
if (verbose && tstate->current_exception != NULL) {
|
||||
fprintf(stderr, "PyThreadState_Clear: warning: thread has an exception set\n");
|
||||
_PyErr_Print(tstate);
|
||||
}
|
||||
|
||||
/* At this point tstate shouldn't be used any more,
|
||||
neither to run Python code nor for other uses.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user