[Python-checkins] r86671 - python/branches/py3k/Tools/scripts/patchcheck.py

eric.araujo python-checkins at python.org
Mon Nov 22 04:13:47 CET 2010


Author: eric.araujo
Date: Mon Nov 22 04:13:47 2010
New Revision: 86671

Log:
Fix resource warning from patchcheck.py


Modified:
   python/branches/py3k/Tools/scripts/patchcheck.py

Modified: python/branches/py3k/Tools/scripts/patchcheck.py
==============================================================================
--- python/branches/py3k/Tools/scripts/patchcheck.py	(original)
+++ python/branches/py3k/Tools/scripts/patchcheck.py	Mon Nov 22 04:13:47 2010
@@ -45,13 +45,16 @@
         sys.exit('need a checkout to get modified files')
 
     st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
-    st.wait()
-    if vcs == 'hg':
-        return [x.decode().rstrip() for x in st.stdout]
-    else:
-        output = (x.decode().rstrip().rsplit(None, 1)[-1]
-                  for x in st.stdout if x[0] in b'AM')
+    try:
+        st.wait()
+        if vcs == 'hg':
+            return [x.decode().rstrip() for x in st.stdout]
+        else:
+            output = (x.decode().rstrip().rsplit(None, 1)[-1]
+                      for x in st.stdout if x[0] in b'AM')
         return set(path for path in output if os.path.isfile(path))
+    finally:
+        st.stdout.close()
 
 
 def report_modified_files(file_paths):


More information about the Python-checkins mailing list