[extensions-web] review: Don't leak file handles



commit e0c52891819d3f7d9caf8ed6d10319b6f7c1ef67
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 26 11:28:26 2012 -0400

    review: Don't leak file handles

 sweettooth/review/views.py |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 247195d..3471d06 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -113,13 +113,12 @@ def get_zipfiles(*args):
 def get_diff(old_zipfile, new_zipfile, filename):
     old, new = old_zipfile.open(filename, 'r'), new_zipfile.open(filename, 'r')
     oldcontent, newcontent = old.read(), new.read()
+    old.close()
+    new.close()
 
     if oldcontent == newcontent:
         return None
 
-    old.close()
-    new.close()
-
     oldlines = oldcontent.splitlines()
     newlines = newcontent.splitlines()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]