summaryrefslogtreecommitdiff
path: root/Parser
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-11-14 13:50:56 -0700
committerGitHub <noreply@github.com>2022-11-14 13:50:56 -0700
commita088290f9d53a6bd078de6ee67b2fa296fc1cc14 (patch)
treecd464c7ed31b1fd4ea145eaa8cb073a7fac70985 /Parser
parent619cadcda6a8ba4a038c1807b6566a90e25db934 (diff)
downloadcpython-git-a088290f9d53a6bd078de6ee67b2fa296fc1cc14.tar.gz
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
Diffstat (limited to 'Parser')
-rwxr-xr-xParser/asdl_c.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 972d89649a..8bdd253fee 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -1483,6 +1483,10 @@ def generate_ast_fini(module_state, f):
for s in module_state:
f.write(" Py_CLEAR(state->" + s + ');\n')
f.write(textwrap.dedent("""
+ if (_PyInterpreterState_Get() == _PyInterpreterState_Main()) {
+ Py_CLEAR(_Py_CACHED_OBJECT(str_replace_inf));
+ }
+
#if !defined(NDEBUG)
state->initialized = -1;
#else