FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Removed some variables that are used to exchange data between import.… · python/cpython@ef3d02e · GitHub

Repository navigation

Commit ef3d02e

Browse files
committed
Removed some variables that are used to exchange data between import.c and
importdl.c: the MAXSUFFIXSIZE macro is now defined in importdl.h, and the modules dictionary is now passed using PyImport_GetModuleDict(). Also undefine USE_SHLIB for AIX -- in AIX 4.2 and up, dlfcn.h exists but we don't want to use it.
1 parent 7661185 commit ef3d02e

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

‎Python/import.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ 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 *_PyImport_Modules; /* This becomes sys.modules */
64+
static PyObject *_PyImport_Modules; /* This becomes sys.modules */
6565

6666

6767
/* Initialize things */
@@ -461,7 +461,7 @@ find_module(name, path, buf, buflen, p_fp)
461461
if (!PyString_Check(v))
462462
continue;
463463
len = PyString_Size(v);
464-
if (len + 2 + namelen + _PyImport_MaxSuffixSize >= buflen)
464+
if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen)
465465
continue; /* Too long */
466466
strcpy(buf, PyString_AsString(v));
467467
if ((int)strlen(buf) != len)

‎Python/importdl.c‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ typedef void (*dl_funcptr)();
126126
#endif
127127

128128
#ifdef _AIX
129+
#undef USE_SHLIB /* AIX 4.2 and higher have dlfcn.h but we don't want it */
129130
#define DYNAMIC_LINK
130131
#define SHORT_EXT ".so"
131132
#define LONG_EXT "module.so"
@@ -201,14 +202,6 @@ extern char *Py_GetProgramName();
201202

202203
#endif /* DYNAMIC_LINK */
203204

204-
/* Max length of module suffix searched for -- accommodates "module.slb" */
205-
#ifndef MAXSUFFIXSIZE
206-
#define MAXSUFFIXSIZE 12
207-
#endif
208-
209-
/* Pass it on to import.c */
210-
int _PyImport_MaxSuffixSize = MAXSUFFIXSIZE;
211-
212205
struct filedescr _PyImport_Filetab[] = {
213206
#ifdef SHORT_EXT
214207
{SHORT_EXT, "rb", C_EXTENSION},
@@ -527,7 +520,7 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
527520
(*p)();
528521
/* XXX Need check for err_occurred() here */
529522

530-
m = PyDict_GetItemString(_PyImport_Modules, name);
523+
m = PyDict_GetItemString(PyImport_GetModuleDict(), name);
531524
if (m == NULL) {
532525
if (PyErr_Occurred() == NULL)
533526
PyErr_SetString(PyExc_SystemError,

‎Python/importdl.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ extern struct filedescr {
4242
enum filetype type;
4343
} _PyImport_Filetab[];
4444

45-
extern PyObject *_PyImport_Modules;
46-
4745
extern PyObject *_PyImport_LoadDynamicModule
4846
Py_PROTO((char *name, char *pathname, FILE *));
4947

50-
extern int _PyImport_MaxSuffixSize;
48+
/* Max length of module suffix searched for -- accommodates "module.slb" */
49+
#define MAXSUFFIXSIZE 12

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL