Commit 184f3d4f authored by Steve Dower's avatar Steve Dower Committed by Miss Islington (bot)

bpo-37364: Use io.open_code() to read .pth files (GH-14299)



https://bugs.python.org/issue37364
parent f5690925
......@@ -73,6 +73,7 @@ import sys
import os
import builtins
import _sitebuiltins
import io
# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = [sys.prefix, sys.exec_prefix]
......@@ -156,7 +157,7 @@ def addpackage(sitedir, name, known_paths):
reset = False
fullname = os.path.join(sitedir, name)
try:
f = open(fullname, "r")
f = io.TextIOWrapper(io.open_code(fullname))
except OSError:
return
with f:
......
:func:`io.open_code` is now used when reading :file:`.pth` files.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment