]> git.phdru.name Git - mimedecode.git/commitdiff
Close infile and outfile even after an exception
authorOleg Broytman <phd@phdru.name>
Wed, 5 Feb 2014 15:42:28 +0000 (19:42 +0400)
committerOleg Broytman <phd@phdru.name>
Wed, 5 Feb 2014 15:42:28 +0000 (19:42 +0400)
mimedecode.py

index 78783ae6e2e7ffe930d5db226d54851e2433f7fe..692a0f0d700706799203af81c59a00b9e8df5ef6 100755 (executable)
@@ -390,7 +390,8 @@ if __name__ == "__main__":
     gopts.outfile = outfile
     output = outfile.write
 
-    decode_file(infile)
-
-    infile.close()
-    outfile.close()
+    try:
+        decode_file(infile)
+    finally:
+        infile.close()
+        outfile.close()