[New-bugs-announce] [issue38638] Backtrace of exit phase of context managers
Alexander Kurakin
report at bugs.python.org
Wed Oct 30 05:21:06 EDT 2019
New submission from Alexander Kurakin <kuraga333 at mail.ru>:
class CM:
def __init__(self):
pass
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
raise RuntimeError()
if __name__ == '__main__':
with CM() as cm:
print('Hello')
$ python3 cm.py
Hello
Traceback (most recent call last):
File "cm.py", line 14, in <module>
print('Hello') # <--
File "cm.py", line 10, in __exit__
raise RuntimeError()
RuntimeError
Is it correct that print presents in backtrace? Well it's the last line but...
Thanks.
----------
components: Interpreter Core
messages: 355698
nosy: kuraga
priority: normal
severity: normal
status: open
title: Backtrace of exit phase of context managers
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38638>
_______________________________________
More information about the New-bugs-announce
mailing list