summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 7fc9d3c..92c8ad0 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -29,6 +29,8 @@
#include "pycore_typeobject.h" // _PyTypes_InitTypes()
#include "pycore_unicodeobject.h" // _PyUnicode_InitTypes()
+extern void _PyIO_Fini(void);
+
#include <locale.h> // setlocale()
#include <stdlib.h> // getenv()
@@ -1702,6 +1704,10 @@ finalize_interp_clear(PyThreadState *tstate)
/* Clear interpreter state and all thread states */
_PyInterpreterState_Clear(tstate);
+ if (is_main_interp) {
+ _PyIO_Fini();
+ }
+
/* Clear all loghooks */
/* Both _PySys_Audit function and users still need PyObject, such as tuple.
Call _PySys_ClearAuditHooks when PyObject available. */