bpo-35416: fix potential resource warnings in distutils (GH-10918)
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 613ea71..11afa24 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -125,8 +125,9 @@
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')