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
Mypy incorrectly reports method signature override inconsistencies with MutableSequence for subclasses of deque, even though the subclass method signature is consistent with the method signature in the deque class. I experienced this for the pop() method, but I suspect this might be the case for other methods where the deque signature overrides the MutableSequence signature, if any.
To Reproduce
Mypy reports an error with the following minimal example:
Bug Report
Mypy incorrectly reports method signature override inconsistencies with
MutableSequence
for subclasses ofdeque
, even though the subclass method signature is consistent with the method signature in thedeque
class. I experienced this for thepop()
method, but I suspect this might be the case for other methods where thedeque
signature overrides theMutableSequence
signature, if any.To Reproduce
Mypy reports an error with the following minimal example:
Expected Behavior
No error reported for the above code
Actual Behavior
The error reported is as follows:
This makes no sense to me as while
MutableSequence
does specify a variant ofpop()
with anindex
parameter (see https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types), theindex
parameter is not supported bydeque
(see https://docs.python.org/3/library/collections.html#collections.deque). This is also confirmed bymypy
if we e.g. change the method to:Then mypy correctly reports:
This is consistent with runtime:
Which results in:
Your Environment
mypy 1.11.1 (compiled: yes)
--config-file=
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: