Title: asyncio blocks custom BaseException exceptions · Issue #108711 · python/cpython · GitHub
Open Graph Title: asyncio blocks custom BaseException exceptions · Issue #108711 · python/cpython
X Title: asyncio blocks custom BaseException exceptions · Issue #108711 · python/cpython
Description: Bug report 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: 3.11 Operating...
Open Graph Description: Bug report 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 CP...
X Description: Bug report 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 CP...
Opengraph URL: https://github.com/python/cpython/issues/108711
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"asyncio blocks custom BaseException exceptions","articleBody":"# Bug report\n\n### Checklist\n\n- [X] I am confident this is a bug in CPython, not a bug in a third-party project\n- [X] I have searched the [CPython issue tracker](https://github.com/python/cpython/issues?q=is%3Aissue+sort%3Acreated-desc),\nand am confident this bug has not been reported before\n\n\n### CPython versions tested on:\n\n3.11\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.11.4 (main, Jun 7 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)]\n\n### A clear and concise description of the bug:\n\nSince bpo-32528, this code no longer works:\n\n```python\nimport asyncio\n\nclass ShowStopper(BaseException):\n pass\n\ndef hello_world(loop):\n print('Hello World')\n raise ShowStopper(\"Stop\")\n\nloop = asyncio.get_event_loop()\n\nloop.call_soon(hello_world, loop)\n\nloop.run_forever()\nloop.close()\n```\n\nI think this behaviour is very surprising as the general behaviour of exceptions based on `BaseException` is that they propagate over error handling. Currently, we'd need to do something hacky like inherit from `SystemExit` instead, basically relegating `BaseException` to something internal.\n\nThis issue was mentioned in the PR, and supposed to be adjusted for Python 3.9:\n\nhttps://github.com/python/cpython/pull/13528#pullrequestreview-241938649\n\nUnfortunately, it seems that was forgotten.","author":{"url":"https://github.com/CendioOssman","@type":"Person","name":"CendioOssman"},"datePublished":"2023-08-31T08:21:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/108711/cpython/issues/108711"}
| 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:cf89cec0-7b94-d5b5-c272-5bd39f9a7959 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C2E:36419E:139766E:19814E3:696B19A8 |
| html-safe-nonce | f6d3fc6ba35e3a72428092e6c6eb6058781da95f9b3303651218890471508fa7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzJFOjM2NDE5RToxMzk3NjZFOjE5ODE0RTM6Njk2QjE5QTgiLCJ2aXNpdG9yX2lkIjoiMjU4MDEwNjQ4NzIzMjY1OTYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a5b7a1916fc4b3b3a7b593b4d369eb2c6dd4930da39b5d1c1bb34cbc61e495c4 |
| hovercard-subject-tag | issue:1875028840 |
| 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/108711/issue_layout |
| twitter:image | https://opengraph.githubassets.com/515dee765fc750118862b67498c38179f2a4d90934dd148ac3e59ce34a86be6e/python/cpython/issues/108711 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/515dee765fc750118862b67498c38179f2a4d90934dd148ac3e59ce34a86be6e/python/cpython/issues/108711 |
| og:image:alt | Bug report 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 CP... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CendioOssman |
| 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