bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. by ericsnowcurrently · Pull Request #30928 · python/cpython · GitHub

github.com

Tin mới

ericsnowcurrently:global-strings

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

awaiting core review

Stop using _Py_IDENTIFIER() in core CPython. faster-cpython/ideas#230

bpo-46541: Generate the global objects initializer. #30941

: Generate the global objects initializer. (

bpo-46430: Intern strings in deep-frozen modules #30683

View reviewed changes

_Py_GET_GLOBAL_IDENTIFIER() -> _Py_ID().

_Py_GET_GLOBAL_STRING() -> _Py_STR().

Use a simpler field prefix than spamspamspam_.

ASCII_STR() -> STRUCT_FOR_ASCII_STR().

LITERAL() -> STRUCT_FOR_STR().

ID() -> STRUCT_FOR_ID().

Use _PyObject_IMMORTAL_INIT().

Drop _Py_STRING_LENGTH().

Inline uses of _Py_ID().

Inline uses of _Py_STR().

Drop _PyObject_IsSingleton(). (C99 undefined makes it too tricky.)

Drop address-taking from _PY_ID() and _Py_STR().

Add a compatibility shim for _PyObject_LookupSpecialId().

Merge branch 'main' into global-strings

View reviewed changes

Learn more about hiding disruptive comments

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

https://github.com/faster-cpython/ideas/discussions

Maybe add this to https://github.com/faster-cpython/ideas/discussions?

Look into string sharing for deep-frozen code faster-cpython/ideas#218

bpo-46210: Fix deadlock in print. #30310

gh-84436: Implement Immortal Objects #19474

Replace _Py_IDENTIFIER() with statically initialized objects. #90699