Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functools.partial breaks templated wrapped function #8341

Closed
crusaderky opened this issue Jan 29, 2020 · 1 comment
Closed

functools.partial breaks templated wrapped function #8341

crusaderky opened this issue Jan 29, 2020 · 1 comment

Comments

@crusaderky
Copy link
Contributor

from functools import partial
from typing import TypeVar

T = TypeVar("T")

def f(x: int) -> int: ...
pf = partial(f)
def g(x: T) -> T: ...
pg = partial(g)


reveal_type(f(1))
reveal_type(pf(1))
reveal_type(g(1))
reveal_type(pg(1))

Python 3.8.1, mypy 0.770+dev.be883f6770b24bc467ccb993fd77864248b61979 output:

note: Revealed type is 'builtins.int'
note: Revealed type is 'builtins.int*'
note: Revealed type is 'builtins.int*'
note: Revealed type is 'T`-1'

Expected output: int in all cases

@JukkaL
Copy link
Collaborator

JukkaL commented Feb 4, 2020

This seems like a duplicate of #1317.

@JukkaL JukkaL closed this as completed Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants