summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/upload.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2010-11-05 23:51:56 (GMT)
committerÉric Araujo <merwok@netwok.org>2010-11-05 23:51:56 (GMT)
commitbee5cef7dbff40734c347da5b93797e8db9103e8 (patch)
tree06dcc726207cfad3016f2b0f7c365fb9fe5b3cc6 /Lib/distutils/command/upload.py
parentafb078dd2673d919ac3733104757c441f256f30f (diff)
downloadcpython-bee5cef7dbff40734c347da5b93797e8db9103e8.zip
cpython-bee5cef7dbff40734c347da5b93797e8db9103e8.tar.gz
cpython-bee5cef7dbff40734c347da5b93797e8db9103e8.tar.bz2
Always close files in distutils code and tests (#10252).
Diffstat (limited to 'Lib/distutils/command/upload.py')
-rw-r--r--Lib/distutils/command/upload.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 99e03d7..4926aa3 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -76,7 +76,11 @@ class upload(PyPIRCCommand):
# Fill in the data - send all the meta-data in case we need to
# register a new release
- content = open(filename,'rb').read()
+ f = open(filename,'rb')
+ try:
+ content = f.read()
+ finally:
+ f.close()
meta = self.distribution.metadata
data = {
# action