mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Always close files in distutils code and tests (#10252).
This commit is contained in:
parent
afb078dd26
commit
bee5cef7db
24 changed files with 261 additions and 171 deletions
|
@ -1012,9 +1012,11 @@ class DistributionMetadata:
|
|||
def write_pkg_info(self, base_dir):
|
||||
"""Write the PKG-INFO file into the release tree.
|
||||
"""
|
||||
pkg_info = open( os.path.join(base_dir, 'PKG-INFO'), 'w')
|
||||
self.write_pkg_file(pkg_info)
|
||||
pkg_info.close()
|
||||
pkg_info = open(os.path.join(base_dir, 'PKG-INFO'), 'w')
|
||||
try:
|
||||
self.write_pkg_file(pkg_info)
|
||||
finally:
|
||||
pkg_info.close()
|
||||
|
||||
def write_pkg_file(self, file):
|
||||
"""Write the PKG-INFO format data to a file object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue