File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def _version_info(exe: str) -> str:
3636
3737def _read_pyvenv_cfg (filename : str ) -> Dict [str , str ]:
3838 ret = {}
39- with open (filename ) as f :
39+ with open (filename , encoding = 'UTF-8' ) as f :
4040 for line in f :
4141 try :
4242 k , v = line .split ('=' )
Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ def test_read_pyvenv_cfg(tmpdir):
2323 assert python ._read_pyvenv_cfg (pyvenv_cfg ) == expected
2424
2525
26+ def test_read_pyvenv_cfg_non_utf8 (tmpdir ):
27+ pyvenv_cfg = tmpdir .join ('pyvenv_cfg' )
28+ pyvenv_cfg .write_binary ('hello = hello john.š\n ' .encode ())
29+ expected = {'hello' : 'hello john.š' }
30+ assert python ._read_pyvenv_cfg (pyvenv_cfg ) == expected
31+
32+
2633def test_norm_version_expanduser ():
2734 home = os .path .expanduser ('~' )
2835 if os .name == 'nt' : # pragma: nt cover
You can’t perform that action at this time.
0 commit comments