Commit 672b6baa authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-32030: pass interp to _PyImport_Init() (#4736)

Remove also the initstr variable, unused since the commit
e69f0df4 pushed in 2012: "bpo-13959:
Re-implement imp.find_module() in Lib/imp.py"
parent a2a25eb0
...@@ -127,7 +127,7 @@ PyAPI_FUNC(const char *) _Py_gitversion(void); ...@@ -127,7 +127,7 @@ PyAPI_FUNC(const char *) _Py_gitversion(void);
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
PyAPI_FUNC(_PyInitError) _PySys_BeginInit(PyObject **sysmod); PyAPI_FUNC(_PyInitError) _PySys_BeginInit(PyObject **sysmod);
PyAPI_FUNC(int) _PySys_EndInit(PyObject *sysdict); PyAPI_FUNC(int) _PySys_EndInit(PyObject *sysdict);
PyAPI_FUNC(_PyInitError) _PyImport_Init(void); PyAPI_FUNC(_PyInitError) _PyImport_Init(PyInterpreterState *interp);
PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod); PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
PyAPI_FUNC(_PyInitError) _PyImportHooks_Init(void); PyAPI_FUNC(_PyInitError) _PyImportHooks_Init(void);
PyAPI_FUNC(int) _PyFrame_Init(void); PyAPI_FUNC(int) _PyFrame_Init(void);
......
...@@ -31,8 +31,6 @@ extern struct _inittab _PyImport_Inittab[]; ...@@ -31,8 +31,6 @@ extern struct _inittab _PyImport_Inittab[];
struct _inittab *PyImport_Inittab = _PyImport_Inittab; struct _inittab *PyImport_Inittab = _PyImport_Inittab;
static PyObject *initstr = NULL;
/*[clinic input] /*[clinic input]
module _imp module _imp
[clinic start generated code]*/ [clinic start generated code]*/
...@@ -43,14 +41,8 @@ module _imp ...@@ -43,14 +41,8 @@ module _imp
/* Initialize things */ /* Initialize things */
_PyInitError _PyInitError
_PyImport_Init(void) _PyImport_Init(PyInterpreterState *interp)
{ {
PyInterpreterState *interp = PyThreadState_Get()->interp;
initstr = PyUnicode_InternFromString("__init__");
if (initstr == NULL) {
return _Py_INIT_ERR("Can't initialize import variables");
}
interp->builtins_copy = PyDict_Copy(interp->builtins); interp->builtins_copy = PyDict_Copy(interp->builtins);
if (interp->builtins_copy == NULL) { if (interp->builtins_copy == NULL) {
return _Py_INIT_ERR("Can't backup builtins dict"); return _Py_INIT_ERR("Can't backup builtins dict");
......
...@@ -751,7 +751,7 @@ _Py_InitializeCore(const _PyCoreConfig *config) ...@@ -751,7 +751,7 @@ _Py_InitializeCore(const _PyCoreConfig *config)
PySys_SetObject("__stderr__", pstderr); PySys_SetObject("__stderr__", pstderr);
Py_DECREF(pstderr); Py_DECREF(pstderr);
err = _PyImport_Init(); err = _PyImport_Init(interp);
if (_Py_INIT_FAILED(err)) { if (_Py_INIT_FAILED(err)) {
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment