Skip to content

Commit

Permalink
Fix EncodingWarnings in distutils/config.py. Ref #232.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 2, 2024
1 parent 03ec237 commit b894d6f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions distutils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def _get_rc_file(self):
def _store_pypirc(self, username, password):
"""Creates a default .pypirc file."""
rc = self._get_rc_file()
with os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
raw = os.open(rc, os.O_CREAT | os.O_WRONLY, 0o600)
with os.fdopen(raw, 'w', encoding='utf-8') as f:
f.write(DEFAULT_PYPIRC % (username, password))

def _read_pypirc(self): # noqa: C901
Expand All @@ -53,7 +54,7 @@ def _read_pypirc(self): # noqa: C901
repository = self.repository or self.DEFAULT_REPOSITORY

config = RawConfigParser()
config.read(rc)
config.read(rc, encoding='utf-8')
sections = config.sections()
if 'distutils' in sections:
# let's get the list of servers
Expand Down

0 comments on commit b894d6f

Please sign in to comment.