Mercurial > cpython-lru_cache-weakref
diff Tools/scripts/patchcheck.py @ 66382:ada67de64919
Fix resource warning from patchcheck.py
| author | Éric Araujo <merwok@netwok.org> |
|---|---|
| date | Mon, 22 Nov 2010 03:13:47 +0000 |
| parents | 2e19d1f4b612 |
| children | 3c9232a684ae |
line wrap: on
line diff
--- a/Tools/scripts/patchcheck.py Mon Nov 22 03:09:19 2010 +0000 +++ b/Tools/scripts/patchcheck.py Mon Nov 22 03:13:47 2010 +0000 @@ -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):
