Title: The `PyOS_*` hooks interact poorly with subinterpreters · Issue #104668 · python/cpython · GitHub
Open Graph Title: The `PyOS_*` hooks interact poorly with subinterpreters · Issue #104668 · python/cpython
X Title: The `PyOS_*` hooks interact poorly with subinterpreters · Issue #104668 · python/cpython
Description: PyOS_InputHook and PyOS_ReadlineFunctionPointer are globally-registered input hooks that have no way of recovering module-level state for the extensions that registered them. In practice, extensions like readline and tkinter get around t...
Open Graph Description: PyOS_InputHook and PyOS_ReadlineFunctionPointer are globally-registered input hooks that have no way of recovering module-level state for the extensions that registered them. In practice, extension...
X Description: PyOS_InputHook and PyOS_ReadlineFunctionPointer are globally-registered input hooks that have no way of recovering module-level state for the extensions that registered them. In practice, extension...
Opengraph URL: https://github.com/python/cpython/issues/104668
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The `PyOS_*` hooks interact poorly with subinterpreters","articleBody":"`PyOS_InputHook` and `PyOS_ReadlineFunctionPointer` are globally-registered `input` hooks that have no way of recovering module-level state for the extensions that registered them. In practice, extensions like `readline` and `tkinter` get around this by using global state, which obviously isn't subinterpreter-friendly.\r\n\r\nWhat's more, extensions without advertised subinterpreter support (like `readline` and `tkinter`) who register these hooks might find themselves called from within a subinterpreter (where their extension hasn't even been loaded). That's definitely a situation we want to avoid.\r\n\r\nIt seems like the best solution for 3.12 is to only call these hooks from the main interpreter, which makes the bad situation quite a bit better. If libraries really need better APIs that work per-interpreter and have ways to access module state, we can certainly add them later (but for now maybe we'll just cross our fingers and hope that nobody actually cares).\r\n\r\n@ericsnowcurrently, how does this sound to you?\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104674\n* gh-104760\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/brandtbucher","@type":"Person","name":"brandtbucher"},"datePublished":"2023-05-19T18:23:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/104668/cpython/issues/104668"}
| 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:d9e91a4b-968a-ddeb-556e-fc7495004e1f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9BB4:19638B:1E6863:2B0CA3:696A064E |
| html-safe-nonce | d2c342ecdf316b3beb7f4f51ebb08d38d8993eb9589323e75bab555df32ae9ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkI0OjE5NjM4QjoxRTY4NjM6MkIwQ0EzOjY5NkEwNjRFIiwidmlzaXRvcl9pZCI6IjExNzE3NjQ0MTI2NjYyMTgwNjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 48c41b1c9f70ce5d0b99c28bc41438b2a86792f55bdb4a88fcef4183571e7180 |
| hovercard-subject-tag | issue:1717646347 |
| 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/104668/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dd06cd3c9359041294d6df647bbd57d398a763d99b903882e6447214577c4c75/python/cpython/issues/104668 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dd06cd3c9359041294d6df647bbd57d398a763d99b903882e6447214577c4c75/python/cpython/issues/104668 |
| og:image:alt | PyOS_InputHook and PyOS_ReadlineFunctionPointer are globally-registered input hooks that have no way of recovering module-level state for the extensions that registered them. In practice, extension... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brandtbucher |
| hostname | github.com |
| expected-hostname | github.com |
| None | 578c119ff0247c8b2f2491fbf4fc0395cdf909d4df66598cebdc96ddfc4418dc |
| 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 | 671c2f67171dbced24284331f3133a613d08c366 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width