This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients martin.panter, r.david.murray, terry.reedy
Date 2015-11-07.00:30:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446856256.19.0.0804402854886.issue25538@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-11-07 00:30:56terry.reedysetrecipients: + terry.reedy, r.david.murray, martin.panter
2015-11-07 00:30:56terry.reedysetmessageid: <1446856256.19.0.0804402854886.issue25538@psf.upfronthosting.co.za>
2015-11-07 00:30:56terry.reedylinkissue25538 messages
2015-11-07 00:30:56terry.reedycreate