Title: Extend and improve `LOAD_COMMON_CONSTANT` · Issue #148871 · python/cpython · GitHub
Open Graph Title: Extend and improve `LOAD_COMMON_CONSTANT` · Issue #148871 · python/cpython
X Title: Extend and improve `LOAD_COMMON_CONSTANT` · Issue #148871 · python/cpython
Description: Currently LOAD_COMMON_CONSTANT only loads 7 not-so-common constants and does so fairly inefficiently. It could be improved in two ways: Add some more constants, especially None, but also "", True, False and -1 Make the constants that it ...
Open Graph Description: Currently LOAD_COMMON_CONSTANT only loads 7 not-so-common constants and does so fairly inefficiently. It could be improved in two ways: Add some more constants, especially None, but also "", True, ...
X Description: Currently LOAD_COMMON_CONSTANT only loads 7 not-so-common constants and does so fairly inefficiently. It could be improved in two ways: Add some more constants, especially None, but also "&quo...
Opengraph URL: https://github.com/python/cpython/issues/148871
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Extend and improve `LOAD_COMMON_CONSTANT`","articleBody":"Currently `LOAD_COMMON_CONSTANT` only loads 7 not-so-common constants and does so fairly inefficiently.\n\nIt could be improved in two ways:\n* Add some more constants, especially `None`, but also `\"\"`, `True`, `False` and `-1` \n* ~Make the constants that it does load both statically allocated and immortal to avoid the pointer chasing and incref operation. Only `any` and `all` would need changing.~\n\nAfter some consideration, I think it best to leave the common constants table per interpreter, and not statically allocate them. \n* The changes to `any` and `all` may be breaking. \n* We also need to handle `AssertionError` and `NotImplementedError` will be tricky to make static\n\nThey should all be immortal though, and stored as `_PyStackRef`s not `PyObject *`s.\n\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-148971\n* gh-149625\n* gh-149688\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/markshannon","@type":"Person","name":"markshannon"},"datePublished":"2026-04-22T09:30:20Z","url":"https://github.com/python/cpython/issues/148871"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:23581cc6-946f-3762-b58e-12a48c8c4948 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 94DE:20AA01:3DD7D71:4E7FAFD:6B01FA4C |
| html-safe-nonce | d0cb5937c94fba6ad97fef9e760f8716ed26ed0b2b2b07190be00be0a7044eb6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NERFOjIwQUEwMTozREQ3RDcxOjRFN0ZBRkQ6NkIwMUZBNEMiLCJ2aXNpdG9yX2lkIjoiNTIxMDg5NzEzMjY4ODYzNjQ5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 19a6210524f9cffca12edeeec64f249c95f34e903a676f9ad9674c45724003af |
| hovercard-subject-tag | issue:4308042187 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/148871/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a488a34321820bdb649acb9d1353f02a5f22be2c3261dd53dae7c1498aba6e7/python/cpython/issues/148871 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a488a34321820bdb649acb9d1353f02a5f22be2c3261dd53dae7c1498aba6e7/python/cpython/issues/148871 |
| og:image:alt | Currently LOAD_COMMON_CONSTANT only loads 7 not-so-common constants and does so fairly inefficiently. It could be improved in two ways: Add some more constants, especially None, but also "", True, ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | markshannon |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width