Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug in linecache when raising exceptiongroup that containsZeroDivisionError + other exception. #101517

Closed
Assignees
iritkatriel
Labels
3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error
@jonathanslenders

Description

@jonathanslenders

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

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp