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
You get the same error without the decorator (delete the @ character and the last two lines entirely). The error is at the instantiation of the partial object.
The problem is the use of an unbound type in a way that mypy cannot handle. Where the error message says "Any" is misleading; the internal state of mypy still has "P" unbound. Notice that mypy is happy if you explicitly annotate or cast with the same dubious type mypy already claims to think it has:
con: Type[custom_vjp[Any]] = custom_vjp
partial(con, x=1) # no issues found
partial(cast(Type[custom_vjp[Any]], custom_vjp), x=1) # no issues found
That's proof that the mypy error message is not really telling you what's gone wrong inside mypy.
I am working on a plugin to properly handle functools.partial and partialmethod. I'll be sure this handle this test case.
The text was updated successfully, but these errors were encountered: