Title: Python 3.12.0a7 can fail to catch exceptions when an iterator is involved · Issue #103488 · python/cpython · GitHub
Open Graph Title: Python 3.12.0a7 can fail to catch exceptions when an iterator is involved · Issue #103488 · python/cpython
X Title: Python 3.12.0a7 can fail to catch exceptions when an iterator is involved · Issue #103488 · python/cpython
Description: Bug report Python 3.12.0a7 (at least as of commit d65ed69) can fail to catch exceptions when an iterator is involved. The following code works on Python 3.11 but the ValueError is uncaught on Python 3.12: #!/usr/bin/env python def do_wor...
Open Graph Description: Bug report Python 3.12.0a7 (at least as of commit d65ed69) can fail to catch exceptions when an iterator is involved. The following code works on Python 3.11 but the ValueError is uncaught on Pytho...
X Description: Bug report Python 3.12.0a7 (at least as of commit d65ed69) can fail to catch exceptions when an iterator is involved. The following code works on Python 3.11 but the ValueError is uncaught on Pytho...
Opengraph URL: https://github.com/python/cpython/issues/103488
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python 3.12.0a7 can fail to catch exceptions when an iterator is involved","articleBody":"# Bug report\r\n\r\nPython 3.12.0a7 (at least as of commit d65ed693a8a13a2a7f9b201bda1224d6ae5fcf0e) can fail to catch exceptions when an iterator is involved. The following code works on Python 3.11 but the `ValueError` is uncaught on Python 3.12:\r\n\r\n```python\r\n#!/usr/bin/env python\r\n\r\ndef do_work():\r\n yield\r\n raise ValueError()\r\n\r\n\r\ndef main():\r\n try:\r\n for _ in do_work():\r\n if True is False:\r\n return\r\n except ValueError:\r\n pass\r\n\r\n\r\nif __name__ == '__main__':\r\n main()\r\n```\r\n\r\nWith this code in `repro.py` the following traceback is shown on Python 3.12:\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"//repro.py\", line 18, in \u003cmodule\u003e\r\n main()\r\n File \"//repro.py\", line 12, in main\r\n return\r\n File \"//repro.py\", line 5, in do_work\r\n raise ValueError()\r\nValueError\r\n```\r\n\r\nNo error or output occurs under Python 3.11.\r\n\r\n# Your environment\r\n\r\nTested on Ubuntu 20.04.5 using the deadsnakes nightly build: python3.12 - 3.12.0~a7-98-gd65ed693a8-1+focal1 \r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103502\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/mattclay","@type":"Person","name":"mattclay"},"datePublished":"2023-04-12T21:32:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/103488/cpython/issues/103488"}
| 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:33f7a844-201a-bb3a-df75-05f7ea76a5a9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8060:36585F:A374BE:E358F6:696A83A4 |
| html-safe-nonce | eec9238778fd0d221800b63104af0e6d7522d177aba0c3ae785838ab4a87dc02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDYwOjM2NTg1RjpBMzc0QkU6RTM1OEY2OjY5NkE4M0E0IiwidmlzaXRvcl9pZCI6IjU1MTIxNzYzNjI0ODgyMzQ5MTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 00c1afb4775bb867f9b3ec86633139d535fdec23d314d719f1a0981fe74818e0 |
| hovercard-subject-tag | issue:1665291585 |
| 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/103488/issue_layout |
| twitter:image | https://opengraph.githubassets.com/27d500018cae33ce59339697ee24e9caf62bbe92175ef85888edd8cf77ab008c/python/cpython/issues/103488 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/27d500018cae33ce59339697ee24e9caf62bbe92175ef85888edd8cf77ab008c/python/cpython/issues/103488 |
| og:image:alt | Bug report Python 3.12.0a7 (at least as of commit d65ed69) can fail to catch exceptions when an iterator is involved. The following code works on Python 3.11 but the ValueError is uncaught on Pytho... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mattclay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 913560fa317c3c5a71e34f9b19253c9f09d02b4b958a86c2a56f4c8541116377 |
| 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 | 5998c30593994bf2589055aef7b22d368a499367 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width