summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-19 22:05:23 (GMT)
committerGitHub <noreply@github.com>2019-06-19 22:05:23 (GMT)
commitb45d259bdda1de2b2d369458a9ad2e4d6f750687 (patch)
tree7e4b308f1729b757ebead804cde061bb06832cab /Python/import.c
parent35068bd059a3d9bff084ca9dcb04d51185b9ec3b (diff)
downloadcpython-b45d259bdda1de2b2d369458a9ad2e4d6f750687.zip
cpython-b45d259bdda1de2b2d369458a9ad2e4d6f750687.tar.gz
cpython-b45d259bdda1de2b2d369458a9ad2e4d6f750687.tar.bz2
bpo-36710: Use tstate in pylifecycle.c (GH-14249)
In pylifecycle.c: pass tstate argument, rather than interp argument, to functions.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index dc0d5b8..3937fbe 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -48,8 +48,9 @@ module _imp
/* Initialize things */
PyStatus
-_PyImport_Init(PyInterpreterState *interp)
+_PyImport_Init(PyThreadState *tstate)
{
+ PyInterpreterState *interp = tstate->interp;
interp->builtins_copy = PyDict_Copy(interp->builtins);
if (interp->builtins_copy == NULL) {
return _PyStatus_ERR("Can't backup builtins dict");
@@ -58,7 +59,7 @@ _PyImport_Init(PyInterpreterState *interp)
}
PyStatus
-_PyImportHooks_Init(void)
+_PyImportHooks_Init(PyThreadState *tstate)
{
PyObject *v, *path_hooks = NULL;
int err = 0;
@@ -89,7 +90,7 @@ _PyImportHooks_Init(void)
return _PyStatus_OK();
error:
- PyErr_Print();
+ _PyErr_Print(tstate);
return _PyStatus_ERR("initializing sys.meta_path, sys.path_hooks, "
"or path_importer_cache failed");
}
@@ -554,7 +555,7 @@ _PyImport_Cleanup(PyThreadState *tstate)
}
Py_XDECREF(dict);
/* Clear module dict copies stored in the interpreter state */
- _PyInterpreterState_ClearModules(tstate->interp);
+ _PyInterpreterState_ClearModules(interp);
/* Collect references */
_PyGC_CollectNoFail();
/* Dump GC stats before it's too late, since it uses the warnings