[Python-Dev] [Python-checkins] cpython (3.4): Issue #23840: tokenize.open() now closes the temporary binary file on error to

Victor Stinner victor.stinner at gmail.com
Tue May 26 09:54:49 CEST 2015

2015-05-26 8:44 GMT+02:00 Serhiy Storchaka <storchaka at gmail.com>:
> No, finally is not correct there. buffer shouldn't be closed if no exception
> is raised.

Yep. The binary file must only be closed in case of error, as written
in the commit message.

> And this is one of the cases in which bare 'except:' is absolutely legal.

The "except: <cleanup code>; raise" is common in the Python stdlib.


More information about the Python-Dev mailing list