Skip to content

Conversation

@srittau
Copy link
Collaborator

@srittau srittau commented Feb 9, 2026


(2026-02-09) Deferred until Python 3.9 branches are removed (expected May 2026).

@srittau
Copy link
Collaborator Author

srittau commented Feb 9, 2026

Part of #15358.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

This can only be done at the same time as removing the second branch here:

if sys.version_info >= (3, 10):
from .mixins import _LoopBoundMixin
else:
_LoopBoundMixin = object

@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator Author

srittau commented Feb 9, 2026

This can only be done at the same time as removing the second branch here:

ruff disagrees. :P

@AlexWaygood
Copy link
Member

AlexWaygood commented Feb 9, 2026

Ohhh, CI now passes here because you removed the pyright-3.9 CI check in the other PR. Hmm, but I'd still lean towards removing the second branch here at the same time as rearranging the order of the base classes? Pyright's previous complaint -- which is what prompted the noqa suppression -- was not a false positive. It was accurately flagging that it really is impossible for type checkers to infer the MRO of a class that inherits from two bases where the first is object and the second is Generic[_T]. It fails at runtime too; there's no way for C3 linearisation to succeed with that sequence of bases:

>>> from typing import Generic, TypeVar
>>> _T = TypeVar("_T")
>>> _LoopBoundMixin = object
>>> class Queue(_LoopBoundMixin, Generic[_T]): ...
... 
Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    class Queue(_LoopBoundMixin, Generic[_T]): ...
TypeError: Cannot create a consistent method resolution order (MRO) for bases object, Generic

@srittau srittau added the status: deferred Issue or PR deferred until some precondition is fixed label Feb 9, 2026
@srittau
Copy link
Collaborator Author

srittau commented Feb 9, 2026

Makes sense. I've deferred this for now, and added it to #13782.

@srittau srittau marked this pull request as draft February 9, 2026 13:49
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: deferred Issue or PR deferred until some precondition is fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants