summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/config.py
diff options
context:
space:
mode:
authorÉric Araujo <aeric@mtlpy.org>2012-12-09 03:57:08 (GMT)
committerÉric Araujo <aeric@mtlpy.org>2012-12-09 03:57:08 (GMT)
commitbb7da03f6e558014d9863cc4501a2ac91c7c2a3a (patch)
treecae020b28344421abc7c3535d425c63c0b6c7119 /Lib/distutils/config.py
parent53f604c79458861553d0ea00db44074b7c4d4333 (diff)
parent3f7c0e403606f7e888442048ac71cb8f391e8d83 (diff)
downloadcpython-bb7da03f6e558014d9863cc4501a2ac91c7c2a3a.zip
cpython-bb7da03f6e558014d9863cc4501a2ac91c7c2a3a.tar.gz
cpython-bb7da03f6e558014d9863cc4501a2ac91c7c2a3a.tar.bz2
Merge fixes for #13614, #13512 and #7719 from 3.3
Diffstat (limited to 'Lib/distutils/config.py')
-rw-r--r--Lib/distutils/config.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py
index 5b625f3..1fd5334 100644
--- a/Lib/distutils/config.py
+++ b/Lib/distutils/config.py
@@ -4,7 +4,6 @@ Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
import os
-import sys
from configparser import ConfigParser
from distutils.cmd import Command
@@ -43,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:
+ with os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
f.write(DEFAULT_PYPIRC % (username, password))
- finally:
- f.close()
- try:
- os.chmod(rc, 0o600)
- except OSError:
- # should do something better here
- pass
def _read_pypirc(self):
"""Reads the .pypirc file."""