Title: Cannot safely Py_EndInterpreter in 3.14b1 · Issue #134144 · python/cpython · GitHub
Open Graph Title: Cannot safely Py_EndInterpreter in 3.14b1 · Issue #134144 · python/cpython
X Title: Cannot safely Py_EndInterpreter in 3.14b1 · Issue #134144 · python/cpython
Description: Crash report What happened? Stack trace: #0 tstate_delete_common.constprop.0 (tstate=tstate@entry=0x555555666ca0, release_gil=0) at ../Python/pystate.c:1854 #1 0x00007ffff78cd341 in zapthreads (interp=0x7ffff74c8010) at ../Python/pystate...
Open Graph Description: Crash report What happened? Stack trace: #0 tstate_delete_common.constprop.0 (tstate=tstate@entry=0x555555666ca0, release_gil=0) at ../Python/pystate.c:1854 #1 0x00007ffff78cd341 in zapthreads (int...
X Description: Crash report What happened? Stack trace: #0 tstate_delete_common.constprop.0 (tstate=tstate@entry=0x555555666ca0, release_gil=0) at ../Python/pystate.c:1854 #1 0x00007ffff78cd341 in zapthreads (int...
Opengraph URL: https://github.com/python/cpython/issues/134144
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot safely Py_EndInterpreter in 3.14b1","articleBody":"# Crash report\n\n### What happened?\n\nStack trace:\n```\n#0 tstate_delete_common.constprop.0 (tstate=tstate@entry=0x555555666ca0, release_gil=0) at ../Python/pystate.c:1854\n#1 0x00007ffff78cd341 in zapthreads (interp=0x7ffff74c8010) at ../Python/pystate.c:1915\n#2 PyInterpreterState_Delete (interp=0x7ffff74c8010) at ../Python/pystate.c:1016\n#3 0x00005555555552ef in main () at repro.c:16\n```\n(note the address passed to tstate_delete_common is definitely corrupt, and not the address of any PyThreadState created in this program)\n\nThis was triggered by creating a new PyThreeadState for the interpreter, switching to it, deleting an old thread state for the same interpreter, and then calling Py_EndInterpreter (on the new thread state).\n\nrepro.c:\n\n```c\n#include \u003cPython.h\u003e\n\nint main()\n{\n Py_Initialize();\n\n PyThreadState *orig = NULL;\n PyInterpreterConfig cfg = _PyInterpreterConfig_INIT;\n Py_NewInterpreterFromConfig(\u0026orig, \u0026cfg);\n\n PyThreadState *temp = PyThreadState_New(orig-\u003einterp);\n PyThreadState_Swap(temp);\n PyThreadState_Clear(orig);\n PyThreadState_Delete(orig);\n Py_EndInterpreter(temp);\n\n Py_Finalize();\n}\n```\n\nCompiled with `$ gcc -O1 -ggdb repro.cpp -I/usr/include/python3.14 -lpython3.14`\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.14.0b1 (main, May 8 2025, 08:57:13) [GCC 13.3.0]\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-134145\n* gh-134182\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/b-pass","@type":"Person","name":"b-pass"},"datePublished":"2025-05-17T14:51:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/134144/cpython/issues/134144"}
| 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:c190e972-2570-a1ea-a1de-8de6efbfbc30 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF06:E3F0D:328257B:42192E8:696B88C0 |
| html-safe-nonce | 499132933308cb801c9426f38a5f44ef936c3a1b9d75f89c695309097e018500 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjA2OkUzRjBEOjMyODI1N0I6NDIxOTJFODo2OTZCODhDMCIsInZpc2l0b3JfaWQiOiIyMzgxNjc3MzcxNjI3MTEyNjQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a45de13973970b7239493138cd4c11dc6dc8e3c950925a78dd7880e819e7bf42 |
| hovercard-subject-tag | issue:3070834404 |
| 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/134144/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f1bc44fefae5a5a1c621534e0ce264f5f443d35a8dc52576711950ee2e4330d4/python/cpython/issues/134144 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f1bc44fefae5a5a1c621534e0ce264f5f443d35a8dc52576711950ee2e4330d4/python/cpython/issues/134144 |
| og:image:alt | Crash report What happened? Stack trace: #0 tstate_delete_common.constprop.0 (tstate=tstate@entry=0x555555666ca0, release_gil=0) at ../Python/pystate.c:1854 #1 0x00007ffff78cd341 in zapthreads (int... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | b-pass |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width