Title: Store current interpreter as a thread local variable · Issue #140544 · python/cpython · GitHub
Open Graph Title: Store current interpreter as a thread local variable · Issue #140544 · python/cpython
X Title: Store current interpreter as a thread local variable · Issue #140544 · python/cpython
Description: There's a lot of code which accesses the current interpreter state especially under free-threading via PyInterpreterState_Get. Currently to lookup interpreter state first the thread state is accessed then read by ts->interp but it can be...
Open Graph Description: There's a lot of code which accesses the current interpreter state especially under free-threading via PyInterpreterState_Get. Currently to lookup interpreter state first the thread state is access...
X Description: There's a lot of code which accesses the current interpreter state especially under free-threading via PyInterpreterState_Get. Currently to lookup interpreter state first the thread state is ac...
Opengraph URL: https://github.com/python/cpython/issues/140544
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Store current interpreter as a thread local variable","articleBody":"There's a lot of code which accesses the current interpreter state especially under free-threading via `PyInterpreterState_Get`. Currently to lookup interpreter state first the thread state is accessed then read by `ts-\u003einterp` but it can be optimized to be stored in a thread local variable `_Py_tss_current_interp` so that it can be read directly. \n\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-140547\n* gh-140573\n* gh-140584\n* gh-140623\n* gh-140690\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/kumaraditya303","@type":"Person","name":"kumaraditya303"},"datePublished":"2025-10-24T13:23:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/140544/cpython/issues/140544"}
| 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:d65f97b6-4beb-2ebb-537b-96ebf1b5fa67 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DFA4:256A62:5ACB50:7B702B:6969DC03 |
| html-safe-nonce | a29aed3818ea4b34e85f01ce8ceaa474e261a9a8e248eca2ced3850f878d5211 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkE0OjI1NkE2Mjo1QUNCNTA6N0I3MDJCOjY5NjlEQzAzIiwidmlzaXRvcl9pZCI6IjMxNzE5MzcxNjc4MTQwMjQxOTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5cce8fbc38cc0cca837d38865e8bf491abeed2229387fcbb9e0278389604b2e3 |
| hovercard-subject-tag | issue:3549494301 |
| 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/140544/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0c1fc239b115a155a999a09c86563ab120ba981fb5a60cac9929d410abb254de/python/cpython/issues/140544 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0c1fc239b115a155a999a09c86563ab120ba981fb5a60cac9929d410abb254de/python/cpython/issues/140544 |
| og:image:alt | There's a lot of code which accesses the current interpreter state especially under free-threading via PyInterpreterState_Get. Currently to lookup interpreter state first the thread state is access... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kumaraditya303 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| 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 | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width