aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index d0e85519d23..8110d94ba17 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -31,7 +31,8 @@
#include "pycore_unicodeobject.h" // _PyUnicode_InitTypes()
#include "opcode.h"
-extern void _PyIO_Fini(void);
+extern PyStatus _PyIO_InitTypes(PyInterpreterState *interp);
+extern void _PyIO_FiniTypes(PyInterpreterState *interp);
#include <locale.h> // setlocale()
#include <stdlib.h> // getenv()
@@ -697,6 +698,11 @@ pycore_init_types(PyInterpreterState *interp)
return _PyStatus_ERR("failed to initialize an exception type");
}
+ status = _PyIO_InitTypes(interp);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
+
status = _PyExc_InitGlobalObjects(interp);
if (_PyStatus_EXCEPTION(status)) {
return status;
@@ -1700,9 +1706,7 @@ finalize_interp_clear(PyThreadState *tstate)
/* Clear interpreter state and all thread states */
_PyInterpreterState_Clear(tstate);
- if (is_main_interp) {
- _PyIO_Fini();
- }
+ _PyIO_FiniTypes(tstate->interp);
/* Clear all loghooks */
/* Both _PySys_Audit function and users still need PyObject, such as tuple.