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
{{ message }}
Repository navigation
"Cannot infer type argument 1 of shutil.copyfileobj" error with mypy 0.780 #8962
Something seems to have changed between mypy 0.770 and 0.780 regarding how overloads are handled. BinaryIO.write() has two overloads: bytearray and bytes in that order (since 2018). When removing the superclass IO[bytes] from BinaryIO, the error message changes to:
error: Argument 1 to "copyfileobj" has incompatible type "BinaryIO"; expected "_Reader[bytearray]"
Here is an example that doesn't rely on typeshed types (assuming that IO is special-cased):
Thanks for reporting the fix! Used mypy_primer to bisect it to #9064 , so probably the result of python/typeshed#4203
While I'm here, I also bisected the original regression to #8845 . Since this issue is "fixed" by the typeshed change, I'm going to close — but maybe @msullivan is curious enough to take a closer look.
Activity
srittau commentedon Jun 8, 2020
Something seems to have changed between mypy 0.770 and 0.780 regarding how overloads are handled.
BinaryIO.write()has two overloads:bytearrayandbytesin that order (since 2018). When removing the superclassIO[bytes]fromBinaryIO, the error message changes to:Here is an example that doesn't rely on typeshed types (assuming that IO is special-cased):
ci: pin mypy version until python/mypy#8962 is resolved
ci: pin mypy version until python/mypy#8962 is resolved
Update all the linting code
ci: pin mypy version until python/mypy#8962 is resolved
Suppress incorrect mypy shutil.copyfileobj error (python/mypy#8962)
McSinyx commentedon Oct 12, 2020
This seems to be fixed by 0.790.
hauntsaninja commentedon Oct 12, 2020
Thanks for reporting the fix! Used mypy_primer to bisect it to #9064 , so probably the result of python/typeshed#4203
While I'm here, I also bisected the original regression to #8845 . Since this issue is "fixed" by the typeshed change, I'm going to close — but maybe @msullivan is curious enough to take a closer look.
mkosi: Autospec creation for update from version 5 to version 8