diff options
author | Victor Stinner <vstinner@python.org> | 2021-01-25 22:12:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-25 22:12:50 (GMT) |
commit | 9852cb38112a4f8d11e26c3423643ea994d5a14f (patch) | |
tree | d211a0c20d5da15318ce1cc1fa1ab87f544749e3 /Python/pylifecycle.c | |
parent | 501d4a51e32c7bbba255598adc307660b5af891a (diff) | |
download | cpython-9852cb38112a4f8d11e26c3423643ea994d5a14f.zip cpython-9852cb38112a4f8d11e26c3423643ea994d5a14f.tar.gz cpython-9852cb38112a4f8d11e26c3423643ea994d5a14f.tar.bz2 |
bpo-42955: Rename module_names to sys.stdlib_module_names (GH-24332)
* Rename _Py_module_names to _Py_stdlib_module_names.
* Rename Python/module_names.h to Python/stdlib_module_names.h.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index a97f45d..bf5dcdd 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -2497,7 +2497,7 @@ fatal_error_exit(int status) // Dump the list of extension modules of sys.modules, excluding stdlib modules -// (sys.module_names), into fd file descriptor. +// (sys.stdlib_module_names), into fd file descriptor. // // This function is called by a signal handler in faulthandler: avoid memory // allocations and keep the implementation simple. For example, the list is not @@ -2519,19 +2519,19 @@ _Py_DumpExtensionModules(int fd, PyInterpreterState *interp) // Avoid PyDict_GetItemString() which calls PyUnicode_FromString(), // memory cannot be allocated on the heap in a signal handler. // Iterate on the dict instead. - PyObject *module_names = NULL; + PyObject *stdlib_module_names = NULL; pos = 0; while (PyDict_Next(interp->sysdict, &pos, &key, &value)) { if (PyUnicode_Check(key) - && PyUnicode_CompareWithASCIIString(key, "module_names") == 0) { - module_names = value; + && PyUnicode_CompareWithASCIIString(key, "stdlib_module_names") == 0) { + stdlib_module_names = value; break; } } - // If we failed to get sys.module_names or it's not a frozenset, + // If we failed to get sys.stdlib_module_names or it's not a frozenset, // don't exclude stdlib modules. - if (module_names != NULL && !PyFrozenSet_Check(module_names)) { - module_names = NULL; + if (stdlib_module_names != NULL && !PyFrozenSet_Check(stdlib_module_names)) { + stdlib_module_names = NULL; } // List extensions @@ -2547,13 +2547,13 @@ _Py_DumpExtensionModules(int fd, PyInterpreterState *interp) } // Use the module name from the sys.modules key, // don't attempt to get the module object name. - if (module_names != NULL) { + if (stdlib_module_names != NULL) { int is_stdlib_ext = 0; - Py_ssize_t i; + Py_ssize_t i = 0; PyObject *item; Py_hash_t hash; - for (i=0; _PySet_NextEntry(module_names, &i, &item, &hash); ) { + while (_PySet_NextEntry(stdlib_module_names, &i, &item, &hash)) { if (PyUnicode_Check(item) && PyUnicode_Compare(key, item) == 0) { |