diff options
author | Éric Araujo <merwok@netwok.org> | 2011-04-17 12:27:07 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-04-17 12:27:07 (GMT) |
commit | dcb22a39366f7bea8aa3359803ee32fe46debf58 (patch) | |
tree | cde8670cb6a701cef98df47b5fc9c4e2385c83ee /Lib/distutils | |
parent | a0b3c32c7a35422c1196824dce1a0c1f7f8969eb (diff) | |
download | cpython-dcb22a39366f7bea8aa3359803ee32fe46debf58.zip cpython-dcb22a39366f7bea8aa3359803ee32fe46debf58.tar.gz cpython-dcb22a39366f7bea8aa3359803ee32fe46debf58.tar.bz2 |
Fix resource warning found manually
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/command/sdist.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 1118060..fdbebd7 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -294,17 +294,20 @@ class sdist(Command): join_lines=1, lstrip_ws=1, rstrip_ws=1, collapse_join=1) - while True: - line = template.readline() - if line is None: # end of file - break - - try: - self.filelist.process_template_line(line) - except DistutilsTemplateError as msg: - self.warn("%s, line %d: %s" % (template.filename, - template.current_line, - msg)) + try: + while True: + line = template.readline() + if line is None: # end of file + break + + try: + self.filelist.process_template_line(line) + except DistutilsTemplateError as msg: + self.warn("%s, line %d: %s" % (template.filename, + template.current_line, + msg)) + finally: + template.close() def prune_file_list(self): """Prune off branches that might slip into the file list as created |