Skip to content

Commit 2892ed4

Browse files
authored
Fix case involving non-ASCII chars on Windows (#17275)
Fixes #16669 One can replicate this error in Windows using Python3.8 just by calling the mypy/pyinfo.py module using a slightly modified code of the `get_search_dirs` function where the python executable doesn't match the value of sys.executable. The only modification made to this code from `get_search_dirs` is the adding of a non-ascii-path to the env parameter
1 parent f5afdcd commit 2892ed4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

mypy/pyinfo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def getsearchdirs() -> tuple[list[str], list[str]]:
7171

7272

7373
if __name__ == "__main__":
74+
sys.stdout.reconfigure(encoding="utf-8") # type: ignore [attr-defined]
7475
if sys.argv[-1] == "getsearchdirs":
7576
print(repr(getsearchdirs()))
7677
else:

0 commit comments

Comments
 (0)