[Python-Dev] [Python-checkins] cpython (3.4): Issue #23840: tokenize.open() now closes the temporary binary file on error to (original) (raw)
R. David Murray rdmurray at bitdance.com
Tue May 26 23:12:49 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 ]
On Tue, 26 May 2015 08:20:01 +0200, Victor Stinner <victor.stinner at gmail.com> wrote:
What is wrong with "except:" in this specific case?
Nothing is wrong with it from a technical standpoint. However, if we use 'except BaseException' that makes it clear that someone has thought about it and decided that all exceptions should be caught, as opposed to it being legacy code or a programming mistake.
> 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.
- 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 ]