From a088290f9d53a6bd078de6ee67b2fa296fc1cc14 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 14 Nov 2022 13:50:56 -0700 Subject: gh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (gh-99487) This moves nearly all remaining object-holding globals in core code (other than static types). https://github.com/python/cpython/issues/81057 --- Python/Python-ast.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/Python-ast.c') diff --git a/Python/Python-ast.c b/Python/Python-ast.c index b57aca377b..31c38e8a80 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 -- cgit v1.2.1