gh-100227: Move _str_replace_inf to PyInterpreterState (gh-102333)

https://github.com/python/cpython/issues/100227
This commit is contained in:
Eric Snow 2023-02-28 14:16:39 -07:00 • committed by GitHub
parent f300a1fa4c
commit 880437d4ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 14 deletions

View file

@ -1484,9 +1484,7 @@ 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));
}
Py_CLEAR(_Py_INTERP_CACHED_OBJECT(interp, str_replace_inf));
#if !defined(NDEBUG)
state->initialized = -1;