mirror of
https://github.com/python/cpython
synced 2024-09-18 22:01:40 +00:00
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.
This commit is contained in:
parent
766118525a
commit
ef3d02ebb9
|
@ -61,7 +61,7 @@ extern long PyOS_GetLastModificationTime(); /* In getmtime.c */
|
||||||
/* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */
|
/* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */
|
||||||
#define MAGIC (20121 | ((long)'\r'<<16) | ((long)'\n'<<24))
|
#define MAGIC (20121 | ((long)'\r'<<16) | ((long)'\n'<<24))
|
||||||
|
|
||||||
PyObject *_PyImport_Modules; /* This becomes sys.modules */
|
static PyObject *_PyImport_Modules; /* This becomes sys.modules */
|
||||||
|
|
||||||
|
|
||||||
/* Initialize things */
|
/* Initialize things */
|
||||||
|
@ -461,7 +461,7 @@ find_module(name, path, buf, buflen, p_fp)
|
||||||
if (!PyString_Check(v))
|
if (!PyString_Check(v))
|
||||||
continue;
|
continue;
|
||||||
len = PyString_Size(v);
|
len = PyString_Size(v);
|
||||||
if (len + 2 + namelen + _PyImport_MaxSuffixSize >= buflen)
|
if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen)
|
||||||
continue; /* Too long */
|
continue; /* Too long */
|
||||||
strcpy(buf, PyString_AsString(v));
|
strcpy(buf, PyString_AsString(v));
|
||||||
if ((int)strlen(buf) != len)
|
if ((int)strlen(buf) != len)
|
||||||
|
|
|
@ -126,6 +126,7 @@ typedef void (*dl_funcptr)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
|
#undef USE_SHLIB /* AIX 4.2 and higher have dlfcn.h but we don't want it */
|
||||||
#define DYNAMIC_LINK
|
#define DYNAMIC_LINK
|
||||||
#define SHORT_EXT ".so"
|
#define SHORT_EXT ".so"
|
||||||
#define LONG_EXT "module.so"
|
#define LONG_EXT "module.so"
|
||||||
|
@ -201,14 +202,6 @@ extern char *Py_GetProgramName();
|
||||||
|
|
||||||
#endif /* DYNAMIC_LINK */
|
#endif /* DYNAMIC_LINK */
|
||||||
|
|
||||||
/* Max length of module suffix searched for -- accommodates "module.slb" */
|
|
||||||
#ifndef MAXSUFFIXSIZE
|
|
||||||
#define MAXSUFFIXSIZE 12
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Pass it on to import.c */
|
|
||||||
int _PyImport_MaxSuffixSize = MAXSUFFIXSIZE;
|
|
||||||
|
|
||||||
struct filedescr _PyImport_Filetab[] = {
|
struct filedescr _PyImport_Filetab[] = {
|
||||||
#ifdef SHORT_EXT
|
#ifdef SHORT_EXT
|
||||||
{SHORT_EXT, "rb", C_EXTENSION},
|
{SHORT_EXT, "rb", C_EXTENSION},
|
||||||
|
@ -527,7 +520,7 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
|
||||||
(*p)();
|
(*p)();
|
||||||
/* XXX Need check for err_occurred() here */
|
/* XXX Need check for err_occurred() here */
|
||||||
|
|
||||||
m = PyDict_GetItemString(_PyImport_Modules, name);
|
m = PyDict_GetItemString(PyImport_GetModuleDict(), name);
|
||||||
if (m == NULL) {
|
if (m == NULL) {
|
||||||
if (PyErr_Occurred() == NULL)
|
if (PyErr_Occurred() == NULL)
|
||||||
PyErr_SetString(PyExc_SystemError,
|
PyErr_SetString(PyExc_SystemError,
|
||||||
|
|
|
@ -42,9 +42,8 @@ extern struct filedescr {
|
||||||
enum filetype type;
|
enum filetype type;
|
||||||
} _PyImport_Filetab[];
|
} _PyImport_Filetab[];
|
||||||
|
|
||||||
extern PyObject *_PyImport_Modules;
|
|
||||||
|
|
||||||
extern PyObject *_PyImport_LoadDynamicModule
|
extern PyObject *_PyImport_LoadDynamicModule
|
||||||
Py_PROTO((char *name, char *pathname, FILE *));
|
Py_PROTO((char *name, char *pathname, FILE *));
|
||||||
|
|
||||||
extern int _PyImport_MaxSuffixSize;
|
/* Max length of module suffix searched for -- accommodates "module.slb" */
|
||||||
|
#define MAXSUFFIXSIZE 12
|
||||||
|
|
Loading…
Reference in a new issue