Title: gh-103571: Add runtime-global strings to the initial per-interpreter interned_dict by Christopher-Chianelli · Pull Request #103572 · python/cpython · GitHub
Open Graph Title: gh-103571: Add runtime-global strings to the initial per-interpreter interned_dict by Christopher-Chianelli · Pull Request #103572 · python/cpython
X Title: gh-103571: Add runtime-global strings to the initial per-interpreter interned_dict by Christopher-Chianelli · Pull Request #103572 · python/cpython
Description: bpo-46430 caused an interesting side effect; the code x = 'a'; x[0] is x no longer returned True. This in turn is because there are two different cached versions of 'a': One that was cached when code in frozen modules was compiled (and is stored in the interned_dict) One that is stored as a runtime-global object that is used during function calls (and is stored in _Py_SINGLETON(strings)) However, some characters do not have this behaviour (for example, 'g', 'u', and 'z'). I suspect it because these characters are not used in co_consts of frozen modules. The interned_dict is per interpreter, and is initialized by init_interned_dict(PyInterpreterState *). The prior implementation initialize it to an empty dict, which allows code in frozen modules to use their (different and per interpreter) singleton strings instead of the runtime-global one. The new implementation add all runtime-global singleton strings to the interned_dict when it initialized, causing the frozen modules to use the same immortal singleton string and for x = 'a'; x[0] is x to return True. Issue: gh-103571
Open Graph Description: bpo-46430 caused an interesting side effect; the code x = 'a'; x[0] is x no longer returned True. This in turn is because there are two different cached versions of 'a': One that w...
X Description: bpo-46430 caused an interesting side effect; the code x = 'a'; x[0] is x no longer returned True. This in turn is because there are two different cached versions of 'a&#...
Opengraph URL: https://github.com/python/cpython/pull/103572
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4ea9b490-a4ad-c6c9-a9dc-75127cf8c957 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BAEC:22DEEF:12250A7:1900528:696A9BEA |
| html-safe-nonce | c275150306270674a8186a36863268cc4bd0ee552b4c90f62e68c0974018475f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQUVDOjIyREVFRjoxMjI1MEE3OjE5MDA1Mjg6Njk2QTlCRUEiLCJ2aXNpdG9yX2lkIjoiNzQzMzY2NDk3MzE3NTk1NDQxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b2b5863a7b3fdf26c22d95caceeb6d53069bd0cbe482f2c4018b597e2d694ba2 |
| hovercard-subject-tag | pull_request:1315291752 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/103572/files |
| twitter:image | https://avatars.githubusercontent.com/u/15825810?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/15825810?s=400&v=4 |
| og:image:alt | bpo-46430 caused an interesting side effect; the code x = 'a'; x[0] is x no longer returned True. This in turn is because there are two different cached versions of 'a': One that w... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c0d8175e41e0e55b9e984c935b24b808cabab919dd3174aa45dac3ef503ed1af |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 99aab454e5ddc8df30805fb76c114c3008a15842 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width