Skip to content

Wrong error location in traceback inside an assert #116034

@solanav

Description

@solanav

Bug report

Bug description:

The location in the traceback for this failed assertion:

test = 3
assert test == 1 and test == 2, "Bug found?"

Seems to be wrong. It should show test == 1 as the source of the error:

Traceback (most recent call last):
  File "/home/.../test.py", line 3, in <module>
    assert test == 1 and test == 2, "Bug found?"
                         ^^^^^^^^^
AssertionError: Bug found?

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions