8000 gh-105716: Fix _PyInterpreterState_IsRunningMain() For Embedders by ericsnowcurrently · Pull Request #117140 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-105716: Fix _PyInterpreterState_IsRunningMain() For Embedders #117140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Drop is_running_main().
  • Loading branch information
ericsnowcurrently committed Mar 21, 2024
commit 00301ee67b983be1ff47303a43158e28f4aa2d4d
15 changes: 2 additions & 13 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,17 +1051,6 @@ _PyInterpreterState_IsRunningMain(PyInterpreterState *interp)
return 0;
}

#ifndef NDEBUG
static int
is_running_main(PyThreadState *tstate)
{
if (tstate->interp->threads.main != NULL) {
return tstate == tstate->interp->threads.main;
}
return 0;
}
#endif

int
_PyThreadState_IsRunningMain(PyThreadState *tstate)
{
Expand Down Expand Up @@ -1572,7 +1561,7 @@ PyThreadState_Clear(PyThreadState *tstate)
{
assert(tstate->_status.initialized && !tstate->_status.cleared);
assert(current_fast_get()->interp == tstate->interp);
assert(!is_running_main(tstate));
assert(!_PyThreadState_IsRunningMain(tstate));
// XXX assert(!tstate->_status.bound || tstate->_status.unbound);
tstate->_status.finalizing = 1; // just in case

Expand Down Expand Up @@ -1671,7 +1660,7 @@ tstate_delete_common(PyThreadState *tstate)
assert(tstate->_status.cleared && !tstate->_status.finalized);
assert(tstate->state != _Py_THREAD_ATTACHED);
tstate_verify_not_active(tstate);
assert(!is_running_main(tstate));
assert(!_PyThreadState_IsRunningMain(tstate));

PyInterpreterState *interp = tstate->interp;
if (interp == NULL) {
Expand Down
0