镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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

ericsnowcurrently merged 12 commits into
python:mainfrom
ericsnowcurrently:global-objects-small-ints

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently 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

@gvanrossum gvanrossum 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 thread Include/internal/pycore_global_objects.h Outdated
@ericsnowcurrently
ericsnowcurrently force-pushed the global-objects-small-ints branch from a20f308 to 8f10ad0 Compare December 13, 2021 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants