From: Victor Stinner Date: Tue, 25 Mar 2014 08:10:59 +0000 (+0100) Subject: Issue #21058: NamedTemporaryFile() closes the FD on any error, not only Exception X-Git-Tag: v2.7.7rc1~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd48b902bb44022e69af766eebbb468068f5e5e1;p=python Issue #21058: NamedTemporaryFile() closes the FD on any error, not only Exception --- diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 94ad0b7ec7..c3246e5c57 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -463,7 +463,7 @@ def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", try: file = _os.fdopen(fd, mode, bufsize) return _TemporaryFileWrapper(file, name, delete) - except Exception: + except: _os.close(fd) raise