bpo-35416: fix potential resource warnings in distutils (GH-10918)

This commit is contained in:
Mickaël Schoentgen 2019-04-08 13:08:48 +00:00 committed by Inada Naoki
parent 7a0630c530
commit 58721a9030
4 changed files with 41 additions and 36 deletions

View file

@ -125,8 +125,9 @@ class upload(PyPIRCCommand):
data['comment'] = ''
if self.sign:
data['gpg_signature'] = (os.path.basename(filename) + ".asc",
open(filename+".asc", "rb").read())
with open(filename + ".asc", "rb") as f:
data['gpg_signature'] = (os.path.basename(filename) + ".asc",
f.read())
# set up the authentication
user_pass = (self.username + ":" + self.password).encode('ascii')