Open aleloi opened 2 years ago
My 'fix' doesn't really work perfectly. Something in Windows+emacs+flycheck doesn't decode the mypy output as unicode, and what I see in Emacs is file.py:1:5: error: Name "γ" is not defined
. But that's probably not a mypy issue.
Update: I tested this with updated mypy 0.950 in Windows and Ubuntu, and couldn't reproduce by calling mypy.exe --show-column-numbers file.py
in the command line. The issue happens only in flycheck in Emacs. I guess that flycheck's python-mypy runs in a special environment where stderr and stdout are opened as TextIO buffers with a non-utf-8 encoding.
Bug Report
When displaying a type error about e.g. a variable that contains unicode characters, mypy crashes.
To Reproduce
file.py
containing the linex=γ
.mypy.exe --show-column-numbers file.py
through flycheck (python-mypy) in EmacsExpected Behavior An error message like
file.py:1:5: error: Name "γ" is not defined
Actual Behavior It crashes and prints a stack trace:
I've fixed it locally by adding
in
mypy/__main__.py
. It works for me, but I don't know whether it's the right thing for mypy.Your Environment
Python 3.9.7, mypy 0.931 on Windows
mypy.ini
(and other config files): None, I think