mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix file handle leak
This commit is contained in:
parent
46c09da3ca
commit
015014ff63
1 changed files with 13 additions and 10 deletions
|
@ -306,17 +306,20 @@ class sdist(Command):
|
||||||
rstrip_ws=1,
|
rstrip_ws=1,
|
||||||
collapse_join=1)
|
collapse_join=1)
|
||||||
|
|
||||||
while 1:
|
try:
|
||||||
line = template.readline()
|
while 1:
|
||||||
if line is None: # end of file
|
line = template.readline()
|
||||||
break
|
if line is None: # end of file
|
||||||
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.filelist.process_template_line(line)
|
self.filelist.process_template_line(line)
|
||||||
except DistutilsTemplateError, msg:
|
except DistutilsTemplateError, msg:
|
||||||
self.warn("%s, line %d: %s" % (template.filename,
|
self.warn("%s, line %d: %s" % (template.filename,
|
||||||
template.current_line,
|
template.current_line,
|
||||||
msg))
|
msg))
|
||||||
|
finally:
|
||||||
|
template.close()
|
||||||
|
|
||||||
def prune_file_list(self):
|
def prune_file_list(self):
|
||||||
"""Prune off branches that might slip into the file list as created
|
"""Prune off branches that might slip into the file list as created
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue