Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Python 3.12.0a7 (at least as of commitd65ed69) can fail to catch exceptions when an iterator is involved. The following code works on Python 3.11 but theValueError is uncaught on Python 3.12:
#!/usr/bin/env pythondefdo_work():yieldraiseValueError()defmain():try:for_indo_work():ifTrueisFalse:returnexceptValueError:passif__name__=='__main__':main()
With this code inrepro.py the following traceback is shown on Python 3.12:
Traceback (most recent call last): File "//repro.py", line 18, in <module> main() File "//repro.py", line 12, in main return File "//repro.py", line 5, in do_work raise ValueError()ValueErrorNo error or output occurs under Python 3.11.
Your environment
Tested on Ubuntu 20.04.5 using the deadsnakes nightly build: python3.12 - 3.12.0~a7-98-gd65ed693a8-1+focal1
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done