[pypy-issue] [issue1260] sys.exc_info not being set before entering a context manager's __exit__

Amaury Forgeot d Arc tracker at bugs.pypy.org
Wed Sep 12 07:58:01 CEST 2012


Amaury Forgeot d Arc <amauryfa at gmail.com> added the comment:

Interesting corner case... PyPy behavior is:

Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "/tmp/t.py", line 10, in <module>
    raise KeyboardInterrupt()
  File "/tmp/t.py", line 7, in __exit__
    raise
TypeError: raise: no active exception to re-raise

CPython2.7 acts as expected, but note that python2.6 is similar to pypy here:
Traceback (most recent call last):
  File "/tmp/t.py", line 10, in <module>
    raise KeyboardInterrupt()
  File "/tmp/t.py", line 7, in __exit__
    raise
TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

And CPython3.2 (or 3.3) does not display the correct traceback:
Traceback (most recent call last):
  File "/tmp/t.py", line 10, in <module>
    raise KeyboardInterrupt()
  File "/tmp/t.py", line 10, in <module>
    raise KeyboardInterrupt()
KeyboardInterrupt

----------
nosy: +afa
status: unread -> chatting

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1260>
________________________________________


More information about the pypy-issue mailing list