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
Ran the mypy development branch on a codebase and it crashed. I managed to reduce the crash to a function parameter typed as a nested Unpack that was passed to an f-string.
The reason I was using the development branch of mypy was that it contained a bug fix not yet in the latest release. Downgrading to 1.6.1 causes the crash to stop happening unless you pass --enable-incomplete-feature=Unpack.
The closest issue I found was #16285 which seems to be closed as completed, but I am still able to produce this crash on the latest development branch which includes the commit that closed the issue.
Traceback
/tmp/hmm.py:5: 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.6.1
Traceback (most recent call last):
File "mypy/checkexpr.py", line 5366, in accept
File "mypy/checkexpr.py", line 452, in visit_call_expr
File "mypy/checkexpr.py", line 581, in visit_call_expr_inner
File "mypy/checkexpr.py", line 1420, in check_call_expr_with_callee_type
File "mypy/checkexpr.py", line 1514, in check_call
File "mypy/checkexpr.py", line 1715, in check_callable_call
File "mypy/checkexpr.py", line 2408, in check_argument_types
AssertionError:
/tmp/hmm.py:5: : note: use --pdb to drop into pdb
changed the title [-]Crash when passing name annotated as nested `Unpack` to f-string[/-][+]Crash involving `tuple[Unpack[tuple]]` annotation[/+]on Oct 31, 2023
Thanks! I have changed the title to better reflect the crash. I wrongly thought the f-strings were involved, as changing the f-string to, e.g., a print call in the example made the crash stop.
Activity
ilevkivskyi commentedon Oct 31, 2023
A more minimal example:
And this is actually a counter-example to the code I never fully understood. I will submit a fix either later today or tomorrow morning.
[-]Crash when passing name annotated as nested `Unpack` to f-string[/-][+]Crash involving `tuple[Unpack[tuple]]` annotation[/+]tjkuson commentedon Oct 31, 2023
Thanks! I have changed the title to better reflect the crash. I wrongly thought the f-strings were involved, as changing the f-string to, e.g., a
printcall in the example made the crash stop.hauntsaninja commentedon Nov 1, 2023
Is the codebase you ran into this on open source?
tjkuson commentedon Nov 1, 2023
No, sorry.
Fix crash on unpack call special-casing (#16381)
Fix crash on unpack call special-casing (#16381)