You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crash typing code that previously on older mypy versions worked fine. Not sure exactly how old the last working mypy version is for this, though (I think the release that broke this would have had to have been some time around January 2023).
Traceback
fmap_mypy_test.py:46: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.2.0
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "mypy\checkexpr.py", line 4885, in accept
File "mypy\nodes.py", line 2032, in accept
File "mypy\checkexpr.py", line 2917, in visit_op_expr
File "mypy\checkexpr.py", line 3486, in check_op
File "mypy\checkexpr.py", line 3408, in check_op_reversible
File "mypy\checkexpr.py", line 3267, in check_method_call
File "mypy\checkexpr.py", line 1303, in check_call
File "mypy\checkexpr.py", line 2252, in check_overload_call
File "mypy\checkexpr.py", line 2406, in infer_overload_return_type
File "mypy\checkexpr.py", line 1292, in check_call
File "mypy\checkexpr.py", line 1432, in check_callable_call
File "mypy\expandtype.py", line 148, in freshen_function_type_vars
File "mypy\expandtype.py", line 77, in expand_type
File "mypy\types.py", line 1869, in accept
File "mypy\expandtype.py", line 418, in visit_callable_type
File "mypy\types.py", line 1357, in accept
File "mypy\expandtype.py", line 230, in visit_instance
File "mypy\expandtype.py", line 458, in expand_types_with_unpack
File "mypy\types.py", line 2656, in accept
File "mypy\expandtype.py", line 484, in visit_union_type
File "mypy\expandtype.py", line 516, in expand_types
File "mypy\types.py", line 1206, in accept
File "mypy\expandtype.py", line 221, in visit_erased_type
RuntimeError:
fmap_mypy_test.py:46: : note: use --pdb to drop into pdb
To Reproduce
I was able to isolate the error down to just a relatively small code snippet. Just run mypy on https://gist.github.com/evhub/10d62ee526dddb9c9b27ad8c4632e32d to reproduce. Lines marked "OFFENDING LINES" are the ones that seem to be causing the error.
Your Environment
Mypy version used: 1.2.0
Mypy command-line flags: just --show-traceback
Mypy configuration options from mypy.ini (and other config files): None
Python version used: 3.9.7
Operating system and version: Windows 10
The text was updated successfully, but these errors were encountered:
…15155)
Fixes#15060
The example in the issue contains another case where an erased type may
legitimately appear in a generic function. Namely, when we have a lambda
in a generic context, and its body contains a call to a generic
_method_. First, since we infer the type of lambda in erased context,
some of lambda parameters may get assigned a type containing erased
components. Then, when accessing a generic method on such type we may
get a callable that is both generic and has erased components, thus
causing the crash (actually there are two very similar crashes depending
on the details of the generic method).
Provided that we now have two legitimate cases for erased type appearing
in `expand_type()`, and special-casing (enabling) them would be tricky
(a lot of functions will need to have `allow_erased_callables`), I
propose to simply remove the check.
Co-authored-by: Shantanu <[email protected]>
Crash Report
Crash typing code that previously on older mypy versions worked fine. Not sure exactly how old the last working mypy version is for this, though (I think the release that broke this would have had to have been some time around January 2023).
Traceback
To Reproduce
I was able to isolate the error down to just a relatively small code snippet. Just run
mypy
on https://gist.github.com/evhub/10d62ee526dddb9c9b27ad8c4632e32d to reproduce. Lines marked "OFFENDING LINES" are the ones that seem to be causing the error.Your Environment
--show-traceback
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: