Skip to content

traceback incorrect with contextlib.contextmanager #736

@slozier

Description

@slozier
import contextlib

@contextlib.contextmanager
def test():
    yield

with test():
    raise Exception

produces the following traceback:

Traceback (most recent call last):
  File "...\contextlib.py", line 77, in __exit__
  File "<stdin>", line 3, in test
Exception

instead of the expected:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
Exception

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions