gh-125268: Use static string for "1e309" in AST (#125272)

When formatting the AST as a string, infinite values are replaced by
1e309, which evaluates to infinity. The initialization of this string
replacement was not thread-safe in the free threading build.
This commit is contained in:
Sam Gross 2024-10-10 16:21:29 -04:00 committed by GitHub
parent bb594e801b
commit 427dcf24de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 11 additions and 32 deletions

View file

@ -2242,8 +2242,6 @@ def generate_ast_fini(module_state, f):
for s in module_state:
f.write(" Py_CLEAR(state->" + s + ');\n')
f.write(textwrap.dedent("""
Py_CLEAR(_Py_INTERP_CACHED_OBJECT(interp, str_replace_inf));
state->finalized = 1;
state->once = (_PyOnceFlag){0};
}