summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2019-06-21 22:16:46 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-21 22:16:46 (GMT)
commit184f3d4f39056f6fe450d007d3b9b61d811a2a4d (patch)
tree72ffc721f5756a9aca14967d2b00b48fe2ed34ba /Lib/site.py
parentf5690925df897cf45818bf944b28d13f37b9f8ca (diff)
downloadcpython-184f3d4f39056f6fe450d007d3b9b61d811a2a4d.zip
cpython-184f3d4f39056f6fe450d007d3b9b61d811a2a4d.tar.gz
cpython-184f3d4f39056f6fe450d007d3b9b61d811a2a4d.tar.bz2
bpo-37364: Use io.open_code() to read .pth files (GH-14299)
https://bugs.python.org/issue37364
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py
index ad11463..e7aafb7 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -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: