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
Something like partial(func, **dict(a=1)) confuses mypy which seems to expect the dictionary keys to contain all the arguments to func, leading to errors if positional arguments are not specified (see this playground / gist), or if only a few arguments are specified and later more as passed to partial's return value (see this playground / gist).
Expected Behavior
I realise that mypy cannot know what ends up in an untyped dictionary, but it should maybe just give up in this case.
Actual Behavior
See gist.
Your Environment
Mypy version used: mypy 1.15.0 (compiled: yes), but also master while using the playground
Mypy command-line flags: none
Mypy configuration options from mypy.ini (and other config files): none
Python version used: 3.10.1, but also 3.13 while using the playground
The text was updated successfully, but these errors were encountered:
barisione
changed the title
Passing **dict(...) for functools.partial confused mypy
Passing **dict(...) for functools.partial confuses mypy
Feb 9, 2025
barisione
changed the title
Passing **dict(...) for functools.partial confuses mypy
Passing **dict(...) to functools.partial confuses mypy
Feb 9, 2025
Bug Report
Something like
partial(func, **dict(a=1))
confuses mypy which seems to expect the dictionary keys to contain all the arguments tofunc
, leading to errors if positional arguments are not specified (see this playground / gist), or if only a few arguments are specified and later more as passed topartial
's return value (see this playground / gist).Expected Behavior
I realise that mypy cannot know what ends up in an untyped dictionary, but it should maybe just give up in this case.
Actual Behavior
See gist.
Your Environment
mypy 1.15.0 (compiled: yes)
, but alsomaster
while using the playgroundmypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: