Skip to content

Commit

Permalink
Fix case involving non-ASCII chars on Windows (#17275)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexlshon committed May 21, 2024
1 parent f5afdcd commit 2892ed4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mypy/pyinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def getsearchdirs() -> tuple[list[str], list[str]]:


if __name__ == "__main__":
sys.stdout.reconfigure(encoding="utf-8") # type: ignore [attr-defined]
if sys.argv[-1] == "getsearchdirs":
print(repr(getsearchdirs()))
else:
Expand Down

0 comments on commit 2892ed4

Please sign in to comment.