[Python-Dev] [Python-checkins] cpython (3.4): Issue #23840: tokenize.open() now closes the temporary binary file on error to (original) (raw)
Victor Stinner victor.stinner at gmail.com
Tue May 26 08:20:01 CEST 2015
- Previous message (by thread): [Python-Dev] [Python-checkins] cpython (3.4): Issue #23840: tokenize.open() now closes the temporary binary file on error to
- Next message (by thread): [Python-Dev] [Python-checkins] cpython (3.4): Issue #23840: tokenize.open() now closes the temporary binary file on error to
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
What is wrong with "except:" in this specific case?
Victor
Le mardi 26 mai 2015, Yury Selivanov <yselivanov.ml at gmail.com> a écrit :
On 2015-05-26 12:26 AM, Terry Reedy wrote: + try: + encoding, lines = detectencoding(buffer.readline) + buffer.seek(0) + text = TextIOWrapper(buffer, encoding, linebuffering=True) + text.mode = 'r' + return text + except: + buffer.close() + raise
Please do not add bare 'except:'. If you mean 'except BaseException:', say so. try..finally would be even better. Yury
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150526/ee476903/attachment.html>
- Previous message (by thread): [Python-Dev] [Python-checkins] cpython (3.4): Issue #23840: tokenize.open() now closes the temporary binary file on error to
- Next message (by thread): [Python-Dev] [Python-checkins] cpython (3.4): Issue #23840: tokenize.open() now closes the temporary binary file on error to
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]