Terry J. Reedy added the comment:

In Martin's example, I would expect the first line of the traceback to be the 
file write that raised the exception, not the print that is never executed.  If 
print were writing to a different device than the first line, the traceback 
would be positively misleading.  

In David's example, the print executed just fine, so it should not appear in 
the traceback either.  The replacement, if any, might be the with statement 
itself.  The 'pseudo-line' that triggers the __exit__ call is really the dedent 
on the next line, but printing the whole next line would be wrong too.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25538>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to