Skip to content

functools.partial no longer matches docs #3080

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

Closed
scop opened this issue Jun 20, 2019 · 2 comments
Closed

functools.partial no longer matches docs #3080

scop opened this issue Jun 20, 2019 · 2 comments

Comments

@scop
Copy link
Contributor

scop commented Jun 20, 2019

In mypy 0.710 due to I suppose commit e45f443, functools partial no longer corresponds with the docs, https://docs.python.org/3/library/functools.html#partial-objects

The docs state they're objects with func, args, and keywords, but they're no longer defined as such, thus cannot be annotated as partial, cannot access the documented attributes etc. For example, this resulted in no problem output with mypy 0.701:

from functools import partial
from typing import Callable

def foo(bar: Callable) -> None:
    func = bar
    while isinstance(func, partial):
        func = func.func

...but now with 0.710 gives:

t.py:6: error: Argument 2 to "isinstance" has incompatible type overloaded function; expected "Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]"
t.py:7: error: "Callable[..., Any]" has no attribute "func"
@JelleZijlstra
Copy link
Member

#3077 will fix this.

@srittau
Copy link
Collaborator

srittau commented Jun 21, 2019

Fixed.

@srittau srittau closed this as completed Jun 21, 2019
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

3 participants