mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
gh-81057: Move PyImport_Inittab to _PyRuntimeState (gh-99402)
We actually don't move PyImport_Inittab. Instead, we make a copy that we keep on _PyRuntimeState and use only that after Py_Initialize(). We also prevent folks from modifying PyImport_Inittab (the best we can) after that point. https://github.com/python/cpython/issues/81057
This commit is contained in:
parent
67807cfc87
commit
7f3a4b967c
9 changed files with 80 additions and 8 deletions
|
|
@ -2252,8 +2252,9 @@ list_builtin_module_names(void)
|
|||
if (list == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (Py_ssize_t i = 0; PyImport_Inittab[i].name != NULL; i++) {
|
||||
PyObject *name = PyUnicode_FromString(PyImport_Inittab[i].name);
|
||||
struct _inittab *inittab = _PyRuntime.imports.inittab;
|
||||
for (Py_ssize_t i = 0; inittab[i].name != NULL; i++) {
|
||||
PyObject *name = PyUnicode_FromString(inittab[i].name);
|
||||
if (name == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue