[issue30860] Consolidate stateful C globals under a single struct.

Nick Coghlan report at bugs.python.org
Thu Jul 6 21:59:22 EDT 2017


Nick Coghlan added the comment:

The core motivation driving the original refactoring was to better understand and consolidate our runtime state in order to clarify what the GIL is actually protecting (aside from the reference counts). That then turned out to have surprising performance benefits (presumably by way of loading all of this state permanently into the CPU cache and then keeping it there).

The changes to the public include files arise more from the fact we don't currently have a common place to put internal CPython headers for declarations we want to share across compilation modules.

I agree the latter is confusing, and it could be worth having a separate "Include/internal/CPython.h" header that outright failed the build if you attempted to include it without Py_BUILD_CORE set.

(This also ties into my comments on the PR, where I believe the current approach of mixing public and private state in the same structs will cause problems with compilers generating incorrect field offsets in extension modules and embedding applications)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30860>
_______________________________________


More information about the Python-bugs-list mailing list