Title: _Py_IsFinalizing has been removed, meaning C/C++ threads cannot avoid termination during shutdown · Issue #108014 · python/cpython · GitHub
Open Graph Title: _Py_IsFinalizing has been removed, meaning C/C++ threads cannot avoid termination during shutdown · Issue #108014 · python/cpython
X Title: _Py_IsFinalizing has been removed, meaning C/C++ threads cannot avoid termination during shutdown · Issue #108014 · python/cpython
Description: Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before CPython versions tested on: CPython main branch Opera...
Open Graph Description: Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before CPython versi...
X Description: Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before CPython versi...
Opengraph URL: https://github.com/python/cpython/issues/108014
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_Py_IsFinalizing has been removed, meaning C/C++ threads cannot avoid termination during shutdown","articleBody":"### Checklist\r\n\r\n- [X] I am confident this is a bug in CPython, not a bug in a third-party project\r\n- [X] I have searched the [CPython issue tracker](https://github.com/python/cpython/issues?q=is%3Aissue+sort%3Acreated-desc),\r\nand am confident this bug has not been reported before\r\n\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\nLinux\r\n\r\n### Output from running 'python -VV' on the command line:\r\n\r\nPython 3.13.0a0 (main, Jul 29 2023, 00:25:05) [GCC 13.1.1 20230614 (Red Hat 13.1.1-4)]\r\n\r\n### A clear and concise description of the bug:\r\n\r\nThreads that call PyEval_RestoreThread while the runtime is finalizing are terminated. The documented way to avoid this is to call _Py_IsFinalizing() to check. https://docs.python.org/3.13/c-api/init.html#c.PyEval_RestoreThread\r\n\r\n_Py_IsFinalizing() has been removed from Python 3.13. Please provide a public API function that has the equivalent behavior, or some other way for a non-Python thread to safely attempt to call into Python code when the interpreter may be finalizing.\r\n\r\nRather than the calling code checking for finalization, an alternative solution would be to provide a variant of PyEval_RestoreThread that returns success or failure, so the calling code can know that it was unable to acquire the GIL, and react accordingly.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-108032\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/dgrisby","@type":"Person","name":"dgrisby"},"datePublished":"2023-08-16T12:21:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/108014/cpython/issues/108014"}
| 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:b15195d0-2429-f807-2ff2-3ad395cdb9ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8C2:64491:1C82F92:27509ED:696AAC0D |
| html-safe-nonce | b406aaadd9709ee40851eb530fb4625db99e0531ad078f658b023d85445e2b6b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEMyOjY0NDkxOjFDODJGOTI6Mjc1MDlFRDo2OTZBQUMwRCIsInZpc2l0b3JfaWQiOiIxMzk2MTQ0MzY2MTgxNTkyMDc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7c0553fa17339fafcc68d8787c5caa76d9652d348313b8516dbe946e3c9db1a4 |
| hovercard-subject-tag | issue:1853127231 |
| 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/108014/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6cd0bd68237e2048d8fac9d56d3d75253d86c48c2b74f36eeab6b6c8e366e29e/python/cpython/issues/108014 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6cd0bd68237e2048d8fac9d56d3d75253d86c48c2b74f36eeab6b6c8e366e29e/python/cpython/issues/108014 |
| og:image:alt | Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before CPython versi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dgrisby |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3eaf9b8cf1badcd7041a8ad480b9d9b28bea0ef1cc821ca9ff20f2cc7f4fe4b9 |
| 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 | dd9a979046e6382bd084e2bd873bf65f797125ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width