Skip to content

Avoid Standalone Sub-structs In pycore_runtime.h #125604

Closed
@ericsnowcurrently

Description

@ericsnowcurrently

pycore_runtime.h is where the _PyRuntimeState struct is declared. Nearly every one of the structs it relies on ("sub-struct") is found in the internal header file that corresponds to that struct's subject matter, rather than in pycore_runtime.h. There are only a few that are declared in pycore_runtime.h, mostly because it was easier to put them there than create the appropriate header files.

In the interest of keeping the focus of pycore_runtime.h on _PyRuntimeState, I'd like to clear out the standalone sub-structs there.

The involves the following:

  • _Py_DebugOffsets - move to its own header file (pycore_debugger_utils.h)
  • struct _getargs_runtime_state - inline in _PyRuntimeState
  • struct _gilstate_runtime_state - inline in _PyRuntimeState
  • _Py_AuditHookEntry - move to its own header file (pycore_audit.h); also move the other audit-related APIs to pycore_audit.h or audit.h (to be added)
  • struct _reftracer_runtime_state - move to pycore_object_state.h

_Py_DebugOffsets is the most meaningful one to move since it is so big (visually occludes _PyRuntimeState). For _Py_AuditHookEntry, we probably should have added pycore_audit.h in the first place.

Linked PRs

Metadata

Metadata

Labels

3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions