diff options
author | Éric Araujo <merwok@netwok.org> | 2010-11-22 03:13:47 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2010-11-22 03:13:47 (GMT) |
commit | 1e600dc01fa294deb05243378e7419df1b6750ba (patch) | |
tree | 98e832781da5885337d18f77fbe26ce126330c8c | |
parent | 28053fb174cd548629b8c94cba02ce837aeb9e5b (diff) | |
download | cpython-1e600dc01fa294deb05243378e7419df1b6750ba.zip cpython-1e600dc01fa294deb05243378e7419df1b6750ba.tar.gz cpython-1e600dc01fa294deb05243378e7419df1b6750ba.tar.bz2 |
Fix resource warning from patchcheck.py
-rw-r--r-- | Tools/scripts/patchcheck.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py index caffc9d..e767eda 100644 --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -45,13 +45,16 @@ def changed_files(): 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): |