Content-Length: 298360 | pFad | http://github.com/python/cpython/pull/117490/commits/05a39235771d62f656824d4c2a059993ffde9747

C2 gh-76785: Handle Legacy Interpreters Properly by ericsnowcurrently · Pull Request #117490 · python/cpython · GitHub
Skip to content

gh-76785: Handle Legacy Interpreters Properly #117490

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
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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/117490/commits/05a39235771d62f656824d4c2a059993ffde9747

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy