Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traceback incorrect with contextlib.contextmanager #736

Open
slozier opened this issue Feb 14, 2020 · 2 comments · May be fixed by #737
Open

traceback incorrect with contextlib.contextmanager #736

slozier opened this issue Feb 14, 2020 · 2 comments · May be fixed by #737
Labels

Comments

@slozier
Copy link
Contributor

slozier commented Feb 14, 2020

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
@slozier
Copy link
Contributor Author

slozier commented Feb 14, 2020

Might be equivalent to:

import sys

def test2():
    yield

try:
    gen = test2()
    raise Exception()
except:
    try:
       gen.throw(*sys.exc_info())
    except:
       pass
    raise

which gives:

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

instead of:

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

@slozier slozier linked a pull request Feb 15, 2020 that will close this issue
@slozier slozier added the bug label Feb 17, 2020
@slozier
Copy link
Contributor Author

slozier commented Feb 17, 2020

Same as IronLanguages/ironpython2#493?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant