diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2022-11-11 21:24:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 21:24:18 (GMT) |
commit | f531b6879b530515b009ac79767702829848cf07 (patch) | |
tree | bf2fbc70bc62929ec8d8806acd284340d9a1b173 /Tools/build/generate_global_objects.py | |
parent | dd36b71fa6164ebba5d94bb4a24eac43b1c54906 (diff) | |
download | cpython-f531b6879b530515b009ac79767702829848cf07.zip cpython-f531b6879b530515b009ac79767702829848cf07.tar.gz cpython-f531b6879b530515b009ac79767702829848cf07.tar.bz2 |
gh-81057: Add PyInterpreterState.static_objects (gh-99397)
As we consolidate global variables, we find some objects that are almost suitable to add to _PyRuntimeState.global_objects, but have some small/sneaky bit of per-interpreter state (e.g. a weakref list). We're adding PyInterpreterState.static_objects so we can move such objects there. (We'll removed the _not_used field once we've added others.)
https://github.com/python/cpython/issues/81057
Diffstat (limited to 'Tools/build/generate_global_objects.py')
-rw-r--r-- | Tools/build/generate_global_objects.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Tools/build/generate_global_objects.py b/Tools/build/generate_global_objects.py index 815045c..b424327 100644 --- a/Tools/build/generate_global_objects.py +++ b/Tools/build/generate_global_objects.py @@ -383,8 +383,10 @@ def generate_global_object_finalizers(generated_immortal_objects): printer.write(START) printer.write('#ifdef Py_DEBUG') printer.write("static inline void") - with printer.block("_PyStaticObjects_CheckRefcnt(void)"): - printer.write('/* generated (see pycore_runtime_init_generated.h) */') + with printer.block( + "_PyStaticObjects_CheckRefcnt(PyInterpreterState *interp)"): + printer.write('/* generated runtime-global */') + printer.write('// (see pycore_runtime_init_generated.h)') for ref in generated_immortal_objects: printer.write(f'_PyStaticObject_CheckRefcnt({ref});') printer.write('/* non-generated */') |