-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
As has been recommended as a workaround, I've tried using a custom typeshed directory to modify the builtins that Mypy sees, so that it recognises the _()
function.
When adding to builtins.pyi:
from gettext import gettext
_ = gettext
I get:
error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.790
Traceback (most recent call last):
File "mypy/semanal.py", line 4700, in accept
File "mypy/nodes.py", line 1141, in accept
File "mypy/semanal.py", line 3186, in visit_return_stmt
File "mypy/nodes.py", line 1545, in accept
File "mypy/semanal.py", line 3537, in visit_call_expr
File "mypy/nodes.py", line 1545, in accept
File "mypy/semanal.py", line 3454, in visit_call_expr
File "mypy/nodes.py", line 1477, in accept
File "mypy/semanal.py", line 3382, in visit_name_expr
File "mypy/semanal.py", line 3895, in lookup
IndexError: string index out of range
Also, when I try:
from gettext import gettext as _
I don't get a crash, but Mypy still doesn't recognise it as a global function. Still producing dozens of:
error: Name '_' is not defined [name-defined]