summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_runtime_init.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-02-15 22:32:31 (GMT)
committerGitHub <noreply@github.com>2023-02-15 22:32:31 (GMT)
commitb2fc5492789623d656953d458f3eeaac03c1ef56 (patch)
treeef2614bd53b935d48170ae2d936ca873ffc92cfc /Include/internal/pycore_runtime_init.h
parentc1ce0d178fe57b50f37578b285a343d77485ac02 (diff)
downloadcpython-b2fc5492789623d656953d458f3eeaac03c1ef56.zip
cpython-b2fc5492789623d656953d458f3eeaac03c1ef56.tar.gz
cpython-b2fc5492789623d656953d458f3eeaac03c1ef56.tar.bz2
gh-101758: Clean Up Uses of Import State (gh-101919)
This change is almost entirely moving code around and hiding import state behind internal API. We introduce no changes to behavior, nor to non-internal API. (Since there was already going to be a lot of churn, I took this as an opportunity to re-organize import.c into topically-grouped sections of code.) The motivation is to simplify a number of upcoming changes. Specific changes: * move existing import-related code to import.c, wherever possible * add internal API for interacting with import state (both global and per-interpreter) * use only API outside of import.c (to limit churn there when changing the location, etc.) * consolidate the import-related state of PyInterpreterState into a single struct field (this changes layout slightly) * add macros for import state in import.c (to simplify changing the location) * group code in import.c into sections *remove _PyState_AddModule() https://github.com/python/cpython/issues/101758
Diffstat (limited to 'Include/internal/pycore_runtime_init.h')
-rw-r--r--Include/internal/pycore_runtime_init.h15
1 files changed, 1 insertions, 14 deletions
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
index c6a27d0..a8d5953 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -97,23 +97,10 @@ extern "C" {
._main_interpreter = _PyInterpreterState_INIT, \
}
-#ifdef HAVE_DLOPEN
-# include <dlfcn.h>
-# if HAVE_DECL_RTLD_NOW
-# define _Py_DLOPEN_FLAGS RTLD_NOW
-# else
-# define _Py_DLOPEN_FLAGS RTLD_LAZY
-# endif
-# define DLOPENFLAGS_INIT .dlopenflags = _Py_DLOPEN_FLAGS,
-#else
-# define _Py_DLOPEN_FLAGS 0
-# define DLOPENFLAGS_INIT
-#endif
-
#define _PyInterpreterState_INIT \
{ \
.id_refcount = -1, \
- DLOPENFLAGS_INIT \
+ .imports = IMPORTS_INIT, \
.ceval = { \
.recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \
}, \