summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/Python-ast.c4
-rw-r--r--Python/ast_unparse.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index b57aca3..31c38e8 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -263,6 +263,10 @@ void _PyAST_Fini(PyInterpreterState *interp)
Py_CLEAR(state->vararg);
Py_CLEAR(state->withitem_type);
+ if (_PyInterpreterState_Get() == _PyInterpreterState_Main()) {
+ Py_CLEAR(_Py_CACHED_OBJECT(str_replace_inf));
+ }
+
#if !defined(NDEBUG)
state->initialized = -1;
#else
diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c
index 6565b6b..79b2e2f 100644
--- a/Python/ast_unparse.c
+++ b/Python/ast_unparse.c
@@ -13,7 +13,7 @@ _Py_DECLARE_STR(open_br, "{");
_Py_DECLARE_STR(dbl_open_br, "{{");
_Py_DECLARE_STR(close_br, "}");
_Py_DECLARE_STR(dbl_close_br, "}}");
-static PyObject *_str_replace_inf;
+#define _str_replace_inf _Py_CACHED_OBJECT(str_replace_inf)
/* Forward declarations for recursion via helper functions. */
static PyObject *