diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-20 17:00:14 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-20 17:00:14 (GMT) |
| commit | c5d5dfdb223efb0e668e3f317d31b8b70ae96aa6 (patch) | |
| tree | 75d656ef90a71f12cdf8b9cdbbaeaf3b4c341156 /Lib/distutils/command/sdist.py | |
| parent | 71f82a2f2085464f5ec99c16bce57bd1631733bd (diff) | |
| download | cpython-c5d5dfdb223efb0e668e3f317d31b8b70ae96aa6.zip cpython-c5d5dfdb223efb0e668e3f317d31b8b70ae96aa6.tar.gz cpython-c5d5dfdb223efb0e668e3f317d31b8b70ae96aa6.tar.bz2 | |
bpo-22831: Use "with" to avoid possible fd leaks in distutils. (GH-10921)
Diffstat (limited to 'Lib/distutils/command/sdist.py')
| -rw-r--r-- | Lib/distutils/command/sdist.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 52eaa15..b4996fc 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -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 |
