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
Consider this code:
fromasyncioimportrun,TaskGroupasyncdefbad_function():raiseZeroDivisionErrorasyncdefbad_function2():raiseKeyErrorasyncdefmain():try:asyncwithTaskGroup()astg:tg.create_task(bad_function())tg.create_task(bad_function2()) except*ZeroDivisionErrorase:breakpoint()run(main())
Run it on Python 3.11 or 3.12:
--Return--Traceback (most recent call last): File"....py", line18, in<module> run(main()) File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line190, inrunreturn runner.run(main)^^^^^^^^^^^^^^^^ File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/asyncio/runners.py", line118, inrunreturnself._loop.run_until_complete(task)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/asyncio/base_events.py", line650, inrun_until_completereturn future.result()^^^^^^^^^^^^^^^ File ".....py", line -1, in main File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/bdb.py", line94, intrace_dispatchreturnself.dispatch_return(frame, arg)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/bdb.py", line153, indispatch_returnself.user_return(frame, arg) File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/pdb.py", line372, inuser_returnself.interaction(frame,None) File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/pdb.py", line434, ininteractionself.print_stack_entry(self.stack[self.curindex]) File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/pdb.py", line1554, inprint_stack_entryself.format_stack_entry(frame_lineno, prompt_prefix))^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/bdb.py", line573, informat_stack_entry line= linecache.getline(filename, lineno, frame.f_globals)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/jonathan/.pyenv/versions/3.11.0/lib/python3.11/linecache.py", line31, ingetlineif1<= lineno<=len(lines):TypeError:'<=' not supported between instances of 'int' and 'NoneType'
One of the exceptions has to be aZeroDivisionError for it to happen as far as I can see.
Your environment
- CPython versions tested on: 3.11, 3.12
- Operating system and architecture: Linux, M1, arm64
Linked PRs
- gh-101517: Fix missing linenumber for re-raise in except* #101663
- gh-101517: Attach line number to the RERAISE at the end of a try-except* #101768
- gh-101517: bdb should not lookup linecache with lineno=None #101787
- [3.11] gh-101517: make bdb avoid looking up in linecache with lineno=None (GH-101787) #101793
- [3.10] gh-101517: make bdb avoid looking up in linecache with lineno=None (GH-101787) #101794
- gh-101517: propagate lasti with RERAISE 1 in except* handling to get currect line numbers #103529
- gh-101517: Add regression test for entering pdb in try/except* block #103547
- gh-101517: fix line number propagation in code generated for except* #103550
- [3.11] gh-101517: fix line number propagation in code generated for except* (#103550) #103816