[Python-checkins] cpython (merge 3.3 -> default): Issue #20244: Fixed possible file leaks when unexpected error raised in
serhiy.storchaka
python-checkins at python.org
Sat Jan 18 15:31:48 CET 2014
http://hg.python.org/cpython/rev/0386cde12657
changeset: 88552:0386cde12657
parent: 88550:40a5c7547c3d
parent: 88551:05d186a1a367
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat Jan 18 16:28:37 2014 +0200
summary:
Issue #20244: Fixed possible file leaks when unexpected error raised in
tarfile open functions.
files:
Lib/tarfile.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -1647,6 +1647,9 @@
if mode == 'r':
raise ReadError("not a bzip2 file")
raise
+ except:
+ fileobj.close()
+ raise
t._extfileobj = False
return t
@@ -1672,6 +1675,9 @@
if mode == 'r':
raise ReadError("not an lzma file")
raise
+ except:
+ fileobj.close()
+ raise
t._extfileobj = False
return t
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list