Title: Assertion failure on interrupt when catching exception group · Issue #102056 · python/cpython · GitHub
Open Graph Title: Assertion failure on interrupt when catching exception group · Issue #102056 · python/cpython
X Title: Assertion failure on interrupt when catching exception group · Issue #102056 · python/cpython
Description: This (maybe too made-up and detached from reality) repro causes assertion failure when executed on current main (32df540). On 3.11 it warns about "lost sys.stderr" and terminates. import time import threading import _thread def f(): try:...
Open Graph Description: This (maybe too made-up and detached from reality) repro causes assertion failure when executed on current main (32df540). On 3.11 it warns about "lost sys.stderr" and terminates. import time impor...
X Description: This (maybe too made-up and detached from reality) repro causes assertion failure when executed on current main (32df540). On 3.11 it warns about "lost sys.stderr" and terminates. import ...
Opengraph URL: https://github.com/python/cpython/issues/102056
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Assertion failure on interrupt when catching exception group","articleBody":"This (maybe too made-up and detached from reality) repro causes assertion failure when executed on current main (32df540635cacce1053ee0ef98ee23f3f6a43c02).\r\nOn 3.11 it warns about \"lost sys.stderr\" and terminates.\r\n\r\n```python3\r\nimport time\r\nimport threading\r\nimport _thread\r\n\r\ndef f():\r\n try:\r\n f()\r\n except RecursionError:\r\n f()\r\n\r\ndef g():\r\n try:\r\n raise ValueError()\r\n except* ValueError:\r\n f()\r\n\r\ndef h():\r\n time.sleep(1)\r\n _thread.interrupt_main()\r\n\r\nt = threading.Thread(target=h)\r\nt.start()\r\ng()\r\nt.join()\r\n```\r\n\r\nOutput:\r\n```\r\npython: Objects/typeobject.c:4183: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed.\r\nAborted (core dumped)\r\n```\r\n\r\nStack trace:\r\n```c++\r\n#0 0x00007ffff7d3f34c in __pthread_kill_implementation () from /usr/lib/libc.so.6\r\n#1 0x00007ffff7cf24b8 in raise () from /usr/lib/libc.so.6\r\n#2 0x00007ffff7cdc534 in abort () from /usr/lib/libc.so.6\r\n#3 0x00007ffff7cdc45c in __assert_fail_base.cold () from /usr/lib/libc.so.6\r\n#4 0x00007ffff7ceb116 in __assert_fail () from /usr/lib/libc.so.6\r\n#5 0x000055555574ecd9 in _PyType_Lookup (type=type@entry=0x555555be5430, name=name@entry=0x555555bb7c10 \u003c_PyRuntime+334480\u003e)\r\n at Objects/typeobject.c:4183\r\n#6 0x00005555557319e3 in _PyObject_GenericGetAttrWithDict (obj=0x7ffff77a7c90, name=0x555555bb7c10 \u003c_PyRuntime+334480\u003e, dict=dict@entry=0x0, \r\n suppress=suppress@entry=1) at Objects/object.c:1266\r\n#7 0x0000555555731d8d in _PyObject_LookupAttr (v=0x7ffff77a7c90, name=\u003coptimized out\u003e, result=result@entry=0x7ffffff40780) at Objects/object.c:933\r\n#8 0x000055555582764c in print_exception_file_and_line (ctx=ctx@entry=0x7fffffffe270, value_p=value_p@entry=0x7ffffff40808)\r\n at Python/pythonrun.c:941\r\n#9 0x0000555555827ed2 in print_exception (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff77a7c90) at Python/pythonrun.c:1209\r\n#10 0x0000555555827fcc in print_exception_group (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff77a7c90) at Python/pythonrun.c:1377\r\n#11 0x0000555555828418 in print_exception_recursive (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff77a7c90) at Python/pythonrun.c:1491\r\n#12 0x0000555555828491 in print_chained (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff77a7c90, \r\n message=message@entry=0x55555594b200 \u003ccontext_message\u003e \"During handling of the above exception, another exception occurred:\\n\", \r\n tag=tag@entry=0x5555558deda0 \"context\") at Python/pythonrun.c:1254\r\n#13 0x000055555582868e in print_exception_cause_and_context (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff780e900)\r\n at Python/pythonrun.c:1344\r\n#14 0x00005555558283d3 in print_exception_recursive (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff780e900) at Python/pythonrun.c:1482\r\n#15 0x0000555555828491 in print_chained (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff780e900, \r\n message=message@entry=0x55555594b200 \u003ccontext_message\u003e \"During handling of the above exception, another exception occurred:\\n\", \r\n tag=tag@entry=0x5555558deda0 \"context\") at Python/pythonrun.c:1254\r\n\r\n...\r\n\r\n#16186 0x000055555582868e in print_exception_cause_and_context (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff6be0ec0)\r\n at Python/pythonrun.c:1344\r\n#16187 0x00005555558283d3 in print_exception_recursive (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff6be0ec0) at Python/pythonrun.c:1482\r\n#16188 0x0000555555828491 in print_chained (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff6be0ec0,\r\n message=message@entry=0x55555594b200 \u003ccontext_message\u003e \"During handling of the above exception, another exception occurred:\\n\",\r\n tag=tag@entry=0x5555558deda0 \"context\") at Python/pythonrun.c:1254\r\n#16189 0x000055555582868e in print_exception_cause_and_context (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff6be0f30)\r\n at Python/pythonrun.c:1344\r\n#16190 0x00005555558283d3 in print_exception_recursive (ctx=ctx@entry=0x7fffffffe270, value=value@entry=0x7ffff6be0f30) at Python/pythonrun.c:1482\r\n#16191 0x0000555555828969 in _PyErr_Display (file=file@entry=0x7ffff79ba7b0, exception=exception@entry=0x555555a75160 \u003c_PyExc_KeyboardInterrupt\u003e,\r\n value=value@entry=0x7ffff6be0f30, tb=tb@entry=0x7ffff6c22ad0) at Python/pythonrun.c:1530\r\n#16192 0x0000555555828ad3 in PyErr_Display (exception=0x555555a75160 \u003c_PyExc_KeyboardInterrupt\u003e, value=0x7ffff6be0f30, tb=0x7ffff6c22ad0)\r\n at Python/pythonrun.c:1562\r\n#16193 0x0000555555835660 in sys_excepthook_impl (module=module@entry=0x7ffff7947f50, exctype=\u003coptimized out\u003e, value=\u003coptimized out\u003e,\r\n traceback=\u003coptimized out\u003e) at ./Python/sysmodule.c:748\r\n#16194 0x00005555558356c6 in sys_excepthook (module=0x7ffff7947f50, args=args@entry=0x7fffffffe3f0, nargs=nargs@entry=3)\r\n at ./Python/clinic/sysmodule.c.h:102\r\n#16195 0x000055555572c28c in cfunction_vectorcall_FASTCALL (func=0x7ffff7948470, args=0x7fffffffe3f0, nargsf=\u003coptimized out\u003e, kwnames=\u003coptimized out\u003e)\r\n at Objects/methodobject.c:422\r\n#16196 0x00005555556e1aa0 in _PyObject_VectorcallTstate (tstate=0x555555bd8808 \u003c_PyRuntime+468616\u003e, callable=callable@entry=0x7ffff7948470,\r\n args=0x7fffffffe3f0, args@entry=0x7fffffffe360, nargsf=nargsf@entry=3, kwnames=kwnames@entry=0x0) at ./Include/internal/pycore_call.h:92\r\n#16197 0x00005555556e1b90 in _PyObject_FastCallTstate (nargs=3, args=0x7fffffffe360, func=0x7ffff7948470, tstate=\u003coptimized out\u003e)\r\n at ./Include/internal/pycore_call.h:116\r\n#16198 _PyObject_FastCall (func=func@entry=0x7ffff7948470, args=args@entry=0x7fffffffe3f0, nargs=nargs@entry=3) at Objects/call.c:310\r\n#16199 0x0000555555828c2b in _PyErr_PrintEx (tstate=0x555555bd8808 \u003c_PyRuntime+468616\u003e, set_sys_last_vars=set_sys_last_vars@entry=1)\r\n at Python/pythonrun.c:813\r\n#16200 0x0000555555828eb1 in PyErr_PrintEx (set_sys_last_vars=set_sys_last_vars@entry=1) at Python/pythonrun.c:861\r\n#16201 0x0000555555828ec1 in PyErr_Print () at Python/pythonrun.c:867\r\n#16202 0x00005555558293ab in _PyRun_SimpleFileObject (fp=fp@entry=0x555555bdb530, filename=filename@entry=0x7ffff77adbc0, closeit=closeit@entry=1,\r\n flags=flags@entry=0x7fffffffe508) at Python/pythonrun.c:439\r\n#16203 0x000055555582951d in _PyRun_AnyFileObject (fp=fp@entry=0x555555bdb530, filename=filename@entry=0x7ffff77adbc0, closeit=closeit@entry=1,\r\n flags=flags@entry=0x7fffffffe508) at Python/pythonrun.c:78\r\n#16204 0x00005555558487a5 in pymain_run_file_obj (program_name=program_name@entry=0x7ffff77c7370, filename=filename@entry=0x7ffff77adbc0,\r\n skip_source_first_line=0) at Modules/main.c:360\r\n#16205 0x00005555558488cd in pymain_run_file (config=config@entry=0x555555bbd3c0 \u003c_PyRuntime+356928\u003e) at Modules/main.c:379\r\n#16206 0x0000555555849063 in pymain_run_python (exitcode=exitcode@entry=0x7fffffffe684) at Modules/main.c:610\r\n#16207 0x000055555584930f in Py_RunMain () at Modules/main.c:689\r\n#16208 0x0000555555849386 in pymain_main (args=args@entry=0x7fffffffe6e0) at Modules/main.c:719\r\n#16209 0x000055555584944c in Py_BytesMain (argc=\u003coptimized out\u003e, argv=\u003coptimized out\u003e) at Modules/main.c:743\r\n#16210 0x0000555555651772 in main (argc=\u003coptimized out\u003e, argv=\u003coptimized out\u003e) at ./Programs/python.c:15\r\n```\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-102078\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/chgnrdv","@type":"Person","name":"chgnrdv"},"datePublished":"2023-02-19T20:43:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/102056/cpython/issues/102056"}
| 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:5d4dfb0d-77cc-8808-11e6-39efbbbd2437 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9A6:3AB2A7:5F1934:7C4ABF:696B4665 |
| html-safe-nonce | 0dc20abc946a6de10ec8e3d2b04fef3ab5b49cca5a52de59b6583220c1e2da92 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUE2OjNBQjJBNzo1RjE5MzQ6N0M0QUJGOjY5NkI0NjY1IiwidmlzaXRvcl9pZCI6IjY5ODYyNjU2NzMxMzAwMDIwMjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7c5d2afe2ec5e890d13c9a08136a877d14bd5cb1619ad1d22fdc0fc9b3cd4764 |
| hovercard-subject-tag | issue:1590847283 |
| 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/102056/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7312242fa886e23abb4c96f1132496fc9695deefa5546036754b9505d31eaf12/python/cpython/issues/102056 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7312242fa886e23abb4c96f1132496fc9695deefa5546036754b9505d31eaf12/python/cpython/issues/102056 |
| og:image:alt | This (maybe too made-up and detached from reality) repro causes assertion failure when executed on current main (32df540). On 3.11 it warns about "lost sys.stderr" and terminates. import time impor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chgnrdv |
| 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