mirror of
https://github.com/python/cpython.git
synced 2025-10-21 06:02:21 +00:00
bpo-22831: Use "with" to avoid possible fd leaks in distutils. (GH-10921)
This commit is contained in:
parent
71f82a2f20
commit
c5d5dfdb22
5 changed files with 63 additions and 67 deletions
|
@ -407,14 +407,13 @@ class sdist(Command):
|
|||
distribution.
|
||||
"""
|
||||
log.info("reading manifest file '%s'", self.manifest)
|
||||
manifest = open(self.manifest)
|
||||
for line in manifest:
|
||||
# ignore comments and blank lines
|
||||
line = line.strip()
|
||||
if line.startswith('#') or not line:
|
||||
continue
|
||||
self.filelist.append(line)
|
||||
manifest.close()
|
||||
with open(self.manifest) as manifest:
|
||||
for line in manifest:
|
||||
# ignore comments and blank lines
|
||||
line = line.strip()
|
||||
if line.startswith('#') or not line:
|
||||
continue
|
||||
self.filelist.append(line)
|
||||
|
||||
def make_release_tree(self, base_dir, files):
|
||||
"""Create the directory tree that will become the source
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue