1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Use encoding option or binary mode for open()

This commit is contained in:
Inada Naoki 2021-02-13 20:45:16 +09:00
parent bbf8466088
commit fb62f2707a
3 changed files with 3 additions and 3 deletions

View file

@ -766,7 +766,7 @@ def _install_wheel(
# Record the REQUESTED file
if requested:
requested_path = os.path.join(dest_info_dir, 'REQUESTED')
with open(requested_path, "w"):
with open(requested_path, "wb"):
pass
generated.append(requested_path)

View file

@ -113,7 +113,7 @@ class RequirementTracker:
assert req not in self._entries
# Start tracking this requirement.
with open(entry_path, 'w') as fp:
with open(entry_path, 'w', encoding="utf-8") as fp:
fp.write(str(req))
self._entries.add(req)

View file

@ -48,7 +48,7 @@ class SelfCheckState:
cache_dir, "selfcheck", _get_statefile_name(self.key)
)
try:
with open(self.statefile_path) as statefile:
with open(self.statefile_path, encoding="utf-8") as statefile:
self.state = json.load(statefile)
except (OSError, ValueError, KeyError):
# Explicitly suppressing exceptions, since we don't want to