Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 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
Call drop_owned() after Py_EndInterpreter(), not before.
  • Loading branch information
ericsnowcurrently committed Apr 11, 2024
commit 05a39235771d62f656824d4c2a059993ffde9747
8 changes: 4 additions & 4 deletions Modules/_xxsubinterpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,8 @@ add_owned(owned_ids *owned, PyInterpreterState *interp)
}

static void
drop_owned(owned_ids *owned, PyInterpreterState *interp)
drop_owned(owned_ids *owned, int64_t interpid)
{
int64_t id = PyInterpreterState_GetID(interp);
#if sizeof(int64_t) <= sizeof(Py_uhash_t)
_Py_hashtable_steal(owned_ids, (const void *)id);
#else
Expand Down Expand Up @@ -758,6 +757,7 @@ interp_destroy(PyObject *self, PyObject *args, PyObject *kwds)
if (interp == NULL) {
return NULL;
}
int64_t interpid = PyInterpreterState_GetID(interp);

// Ensure we don't try to destroy the current interpreter.
PyInterpreterState *current = _get_current_interp();
Expand All @@ -778,11 +778,11 @@ interp_destroy(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}

drop_owned(&_globals.owned, interp);

// Destroy the interpreter.
_PyXI_EndInterpreter(interp, NULL, NULL);

drop_owned(&_globals.owned, interpid);

Py_RETURN_NONE;
}

Expand Down