8000 [WIP] bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). by ericsnowcurrently · Pull Request #9334 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[WIP] bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). #9334

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

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
Make any remaining pending calls before shutdown.
  • Loading branch information
ericsnowcurrently committed Sep 15, 2018
commit 1ceba050231c1eac0f8ca7bc024829e6a2ea3da8
15 changes: 15 additions & 0 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,21 @@ Py_EndInterpreter(PyThreadState *tstate)
Py_FatalError("Py_EndInterpreter: thread still has a frame");

wait_for_thread_shutdown();
// XXX Forcibly mark current thread as active?
assert(interp->ceval.active);
assert(interp->ceval.active_thread == PyThread_get_thread_ident());

if (_Py_atomic_load_relaxed(
&(interp->ceval.pending.calls_to_do)))
{
if (_Py_MakePendingCalls(interp) < 0) {
PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
PyErr_BadInternalCall();
_PyErr_ChainExceptions(exc, val, tb);
PyErr_Print();
}
}

call_py_exitfuncs(interp);

Expand Down
2 changes: 0 additions & 2 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ void
PyInterpreterState_Clear(PyInterpreterState *interp)
{
PyThreadState *p;
// XXX Also ensure that all pending calls have been made. Disallow
// registration of more pending calls.
HEAD_LOCK();
for (p = interp->tstate_head; p != NULL; p = p->next)
PyThreadState_Clear(p);
Expand Down
0