bpo-30860: Consolidate stateful runtime globals. by ericsnowcurrently · Pull Request #2594 · python/cpython (original) (raw)
Having these Py_BUILD_CORE
conditionals inside the struct definitions doesn't look right to me - don't they mean that the compiler will generate incorrect field offsets when compiled without Py_BUILD_CORE
set?
Even having a Py_BUILD_CORE
block at the end of the struct definitions seems problematic, since we later compose them all into a single struct, where the non-core builds would again get the field sizes wrong.
So if we're going to have a distinction between "public" runtime state (accessible via macros in the public C API) and "private" runtime state (accessible only when "Py_BUILD_CORE" is set), it seems to me that distinction is going to need to be handled by having two different top level runtime structs (one public and one private), and having a similar split for every section that includes non-public process global state.