Skip to content

Commit af5dfb4

Browse files
committed
One last rename glitch: import_modules -> _PyImport_Modules.
1 parent 39d6ae7 commit af5dfb4

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Python/import.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ extern long PyOS_GetLastModificationTime(); /* In getmtime.c */
6161
/* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */
6262
#define MAGIC (20121 | ((long)'\r'<<16) | ((long)'\n'<<24))
6363

64-
PyObject *import_modules; /* This becomes sys.modules */
64+
PyObject *_PyImport_Modules; /* This becomes sys.modules */
6565

6666

6767
/* Initialize things */
6868

6969
void
7070
PyImport_Init()
7171
{
72-
if (import_modules != NULL)
72+
if (_PyImport_Modules != NULL)
7373
Py_FatalError("duplicate initimport() call");
74-
if ((import_modules = PyDict_New()) == NULL)
74+
if ((_PyImport_Modules = PyDict_New()) == NULL)
7575
Py_FatalError("no mem for dictionary of modules");
7676
if (Py_OptimizeFlag) {
7777
/* Replace ".pyc" with ".pyo" in import_filetab */
@@ -89,9 +89,9 @@ PyImport_Init()
8989
void
9090
PyImport_Cleanup()
9191
{
92-
if (import_modules != NULL) {
93-
PyObject *tmp = import_modules;
94-
import_modules = NULL;
92+
if (_PyImport_Modules != NULL) {
93+
PyObject *tmp = _PyImport_Modules;
94+
_PyImport_Modules = NULL;
9595
/* This deletes all modules from sys.modules.
9696
When a module is deallocated, it in turn clears its
9797
dictionary, thus hopefully breaking any circular
@@ -118,7 +118,7 @@ PyImport_GetMagicNumber()
118118
PyObject *
119119
PyImport_GetModuleDict()
120120
{
121-
return import_modules;
121+
return _PyImport_Modules;
122122
}
123123

124124

@@ -134,18 +134,18 @@ PyImport_AddModule(name)
134134
{
135135
PyObject *m;
136136

137-
if (import_modules == NULL) {
137+
if (_PyImport_Modules == NULL) {
138138
PyErr_SetString(PyExc_SystemError,
139139
"sys.modules has been deleted");
140140
return NULL;
141141
}
142-
if ((m = PyDict_GetItemString(import_modules, name)) != NULL &&
142+
if ((m = PyDict_GetItemString(_PyImport_Modules, name)) != NULL &&
143143
PyModule_Check(m))
144144
return m;
145145
m = PyModule_New(name);
146146
if (m == NULL)
147147
return NULL;
148-
if (PyDict_SetItemString(import_modules, name, m) != 0) {
148+
if (PyDict_SetItemString(_PyImport_Modules, name, m) != 0) {
149149
Py_DECREF(m);
150150
return NULL;
151151
}
@@ -661,12 +661,12 @@ PyImport_ImportModule(name)
661661
{
662662
PyObject *m;
663663

664-
if (import_modules == NULL) {
664+
if (_PyImport_Modules == NULL) {
665665
PyErr_SetString(PyExc_SystemError,
666666
"sys.modules has been deleted");
667667
return NULL;
668668
}
669-
if ((m = PyDict_GetItemString(import_modules, name)) != NULL) {
669+
if ((m = PyDict_GetItemString(_PyImport_Modules, name)) != NULL) {
670670
Py_INCREF(m);
671671
}
672672
else {
@@ -675,7 +675,7 @@ PyImport_ImportModule(name)
675675
(i = PyImport_ImportFrozenModule(name))) {
676676
if (i < 0)
677677
return NULL;
678-
if ((m = PyDict_GetItemString(import_modules,
678+
if ((m = PyDict_GetItemString(_PyImport_Modules,
679679
name)) == NULL) {
680680
if (PyErr_Occurred() == NULL)
681681
PyErr_SetString(PyExc_SystemError,
@@ -710,12 +710,12 @@ PyImport_ReloadModule(m)
710710
name = PyModule_GetName(m);
711711
if (name == NULL)
712712
return NULL;
713-
if (import_modules == NULL) {
713+
if (_PyImport_Modules == NULL) {
714714
PyErr_SetString(PyExc_SystemError,
715715
"sys.modules has been deleted");
716716
return NULL;
717717
}
718-
if (m != PyDict_GetItemString(import_modules, name)) {
718+
if (m != PyDict_GetItemString(_PyImport_Modules, name)) {
719719
PyErr_SetString(PyExc_ImportError,
720720
"reload() module not in sys.modules");
721721
return NULL;

Python/importdl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
527527
(*p)();
528528
/* XXX Need check for err_occurred() here */
529529

530-
m = PyDict_GetItemString(import_modules, name);
530+
m = PyDict_GetItemString(_PyImport_Modules, name);
531531
if (m == NULL) {
532532
if (PyErr_Occurred() == NULL)
533533
PyErr_SetString(PyExc_SystemError,

Python/importdl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extern struct filedescr {
4242
enum filetype type;
4343
} _PyImport_Filetab[];
4444

45-
extern PyObject *import_modules;
45+
extern PyObject *_PyImport_Modules;
4646

4747
extern PyObject *_PyImport_LoadDynamicModule
4848
Py_PROTO((char *name, char *pathname, FILE *));

0 commit comments

Comments
 (0)