Skip to content

bpo-45953: Statically initialize the small ints. - #30092

Merged
ericsnowcurrently merged 12 commits into
python:mainfrom
ericsnowcurrently:global-objects-small-ints
Dec 14, 2021
Merged

bpo-45953: Statically initialize the small ints.#30092
ericsnowcurrently merged 12 commits into
python:mainfrom
ericsnowcurrently:global-objects-small-ints

Conversation

@ericsnowcurrently

@ericsnowcurrentlyericsnowcurrently commented Dec 13, 2021

Copy link
Copy Markdown
Member

The array of small PyLong objects has been statically declared. Here I also statically initialize them. Consequently they are no longer initialized dynamically during runtime init.

I've also moved them under a new sub-struct in _PyRuntimeState, in preparation for static allocation and initialization of other global objects.

FWIW, I considered adding a script for generating the array initializer, but figured that can be done separately if valuable.

https://bugs.python.org/issue45953

@gvanrossumgvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I have a nit in a comment but it was present in the original before the move as well.

Comment threadInclude/internal/pycore_global_objects.h Outdated
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@ericsnowcurrently@gvanrossum@the-knights-who-say-ni@bedevere-bot