We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d6d84e7 + 810385b commit e8f5219Copy full SHA for e8f5219
news/8717.bugfix
@@ -0,0 +1 @@
1
+Always use UTF-8 to read ``pyvenv.cfg`` to match the built-in ``venv``.
src/pip/_internal/utils/virtualenv.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import
2
3
+import io
4
import logging
5
import os
6
import re
@@ -51,7 +52,9 @@ def _get_pyvenv_cfg_lines():
51
52
"""
53
pyvenv_cfg_file = os.path.join(sys.prefix, 'pyvenv.cfg')
54
try:
- with open(pyvenv_cfg_file) as f:
55
+ # Although PEP 405 does not specify, the built-in venv module always
56
+ # writes with UTF-8. (pypa/pip#8717)
57
+ with io.open(pyvenv_cfg_file, encoding='utf-8') as f:
58
return f.read().splitlines() # avoids trailing newlines
59
except IOError:
60
return None
0 commit comments