gh-81057: Move More Globals in Core Code to _PyRuntimeState (gh-99516)

https://github.com/python/cpython/issues/81057
This commit is contained in:
Eric Snow 2022-11-16 09:37:14 -07:00 committed by GitHub
parent 5cfb7d19f5
commit 5f55067e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 241 additions and 130 deletions

View file

@ -160,6 +160,7 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
p0 = (PyModInitFunction)exportfunc;
/* Package context is needed for single-phase init */
#define _Py_PackageContext (_PyRuntime.imports.pkgcontext)
oldcontext = _Py_PackageContext;
_Py_PackageContext = PyUnicode_AsUTF8(name_unicode);
if (_Py_PackageContext == NULL) {
@ -168,6 +169,7 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
}
m = _PyImport_InitFunc_TrampolineCall(p0);
_Py_PackageContext = oldcontext;
#undef _Py_PackageContext
if (m == NULL) {
if (!PyErr_Occurred()) {