Skip to content

functools.partial false negative with higher order functions #17461

Open
@hauntsaninja

Description

@hauntsaninja

See #17425 , in particular this comment #17425 (comment) from ilevkivskyi

[case testFunctoolsPartialHigherOrder]
from functools import partial
from typing import Callable

def fn(a: int, b: str, c: bytes) -> int: ...

def callback1(fn: Callable[[str, bytes], int]) -> None: ...
def callback2(fn: Callable[[str, int], int]) -> None: ...

callback1(partial(fn, 1))
# TODO: false negative
callback2(partial(fn, 1))
[builtins fixtures/tuple.pyi]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions