mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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
This commit is contained in:
parent
dd36b71fa6
commit
f531b6879b
6 changed files with 35 additions and 5 deletions
|
@ -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 */')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue