Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > media > main-updates-src > by-pkgid > 70c6f73b7de273a264c9a8c049dad72b > files > 4

python-2.7.2-2.2.src.rpm

diff -Naurp Python-2.7.2/Lib/distutils/config.py Python-2.7.2.oden/Lib/distutils/config.py
--- Python-2.7.2/Lib/distutils/config.py	2011-06-11 15:46:24.000000000 +0000
+++ Python-2.7.2.oden/Lib/distutils/config.py	2012-06-19 11:52:14.000000000 +0000
@@ -42,16 +42,8 @@ class PyPIRCCommand(Command):
     def _store_pypirc(self, username, password):
         """Creates a default .pypirc file."""
         rc = self._get_rc_file()
-        f = open(rc, 'w')
-        try:
-            f.write(DEFAULT_PYPIRC % (username, password))
-        finally:
-            f.close()
-        try:
-            os.chmod(rc, 0600)
-        except OSError:
-            # should do something better here
-            pass
+        with os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0600), 'w') as fp:
+            fp.write(DEFAULT_PYPIRC % (username, password))
 
     def _read_pypirc(self):
         """Reads the .pypirc file."""