diff Lib/distutils/command/upload.py @ 65993:3bf86785cd9c

Always close files in distutils code and tests (#10252).
author Éric Araujo <merwok@netwok.org>
date Fri, 05 Nov 2010 23:51:56 +0000
parents 8923e1493a34
children 3c9232a684ae
line wrap: on
line diff
--- a/Lib/distutils/command/upload.py	Fri Nov 05 22:18:28 2010 +0000
+++ b/Lib/distutils/command/upload.py	Fri Nov 05 23:51:56 2010 +0000
@@ -76,7 +76,11 @@
 
         # 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