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
I was trying to make async wrapper over shutil.copyfile and met a problem: Mypy: Argument 3 to "to_thread" has incompatible type "Path"; expected "_StrOrBytesPathT"
dst argument is acceptable for using (At least I didn't see any problems in code below and while using copyfile in console).
But this code passes check:
Here's a minimal repro of this problem (which reproduces on the master branch) that doesn't depend on the typeshed stubs for asyncio.to_thread or shutil.copyfile:
fromtypingimportCallable, TypeVarfromtyping_extensionsimportParamSpecP=ParamSpec("P")
T=TypeVar("T")
defhigher_order(func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) ->T: ...
defidentity(arg: T) ->T: ...
higher_order(identity, 'foo') # error: Argument 2 to "higher_order" has incompatible type "str"; expected "T"
Bug Report
I was trying to make async wrapper over
shutil.copyfile
and met a problem:Mypy: Argument 3 to "to_thread" has incompatible type "Path"; expected "_StrOrBytesPathT"
To Reproduce
Expected Behavior
dst
argument is acceptable for using (At least I didn't see any problems in code below and while usingcopyfile
in console).But this code passes check:
Actual Behavior
For some reason, MyPy says that third argument (which is second for
shutil.copyfile
) is wrong type.Your Environment
mypy.ini
(and other config files): no fileWarning
I'm not pro with mypy, so try to reproduce this bug and text me if you cannot for some reasons.
The text was updated successfully, but these errors were encountered: