summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/import.h4
-rw-r--r--Include/internal/pycore_import.h34
-rw-r--r--Include/internal/pycore_runtime_init.h10
3 files changed, 23 insertions, 25 deletions
diff --git a/Include/cpython/import.h b/Include/cpython/import.h
index a58801b..2bca4ad 100644
--- a/Include/cpython/import.h
+++ b/Include/cpython/import.h
@@ -10,8 +10,8 @@ PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(_Py_Identifier *name);
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);
PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module);
-PyAPI_FUNC(void) _PyImport_AcquireLock(void);
-PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
+PyAPI_FUNC(void) _PyImport_AcquireLock(PyInterpreterState *interp);
+PyAPI_FUNC(int) _PyImport_ReleaseLock(PyInterpreterState *interp);
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
PyObject *mod,
diff --git a/Include/internal/pycore_import.h b/Include/internal/pycore_import.h
index b7ffe01..69ed627 100644
--- a/Include/internal/pycore_import.h
+++ b/Include/internal/pycore_import.h
@@ -21,17 +21,6 @@ struct _import_runtime_state {
This is initialized lazily in _PyImport_FixupExtensionObject().
Modules are added there and looked up in _imp.find_extension(). */
PyObject *extensions;
- /* The global import lock. */
- struct {
- PyThread_type_lock mutex;
- unsigned long thread;
- int level;
- } lock;
- struct {
- int import_level;
- _PyTime_t accumulated;
- int header;
- } find_and_load;
/* Package context -- the full module name for package imports */
const char * pkgcontext;
};
@@ -69,6 +58,18 @@ struct _import_state {
int dlopenflags;
#endif
PyObject *import_func;
+ /* The global import lock. */
+ struct {
+ PyThread_type_lock mutex;
+ unsigned long thread;
+ int level;
+ } lock;
+ /* diagnostic info in PyImport_ImportModuleLevelObject() */
+ struct {
+ int import_level;
+ _PyTime_t accumulated;
+ int header;
+ } find_and_load;
};
#ifdef HAVE_DLOPEN
@@ -86,8 +87,15 @@ struct _import_state {
#define IMPORTS_INIT \
{ \
- .override_frozen_modules = 0, \
DLOPENFLAGS_INIT \
+ .lock = { \
+ .mutex = NULL, \
+ .thread = PYTHREAD_INVALID_THREAD_ID, \
+ .level = 0, \
+ }, \
+ .find_and_load = { \
+ .header = 1, \
+ }, \
}
extern void _PyImport_ClearCore(PyInterpreterState *interp);
@@ -138,7 +146,7 @@ extern void _PyImport_FiniExternal(PyInterpreterState *interp);
#ifdef HAVE_FORK
-extern PyStatus _PyImport_ReInitLock(void);
+extern PyStatus _PyImport_ReInitLock(PyInterpreterState *interp);
#endif
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
index efc82b4..bdecac9 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -40,16 +40,6 @@ extern PyTypeObject _PyExc_MemoryError;
in accordance with the specification. */ \
.autoTSSkey = Py_tss_NEEDS_INIT, \
.parser = _parser_runtime_state_INIT, \
- .imports = { \
- .lock = { \
- .mutex = NULL, \
- .thread = PYTHREAD_INVALID_THREAD_ID, \
- .level = 0, \
- }, \
- .find_and_load = { \
- .header = 1, \
- }, \
- }, \
.ceval = { \
.perf = _PyEval_RUNTIME_PERF_INIT, \
}, \