Skip to content

Commit

Permalink
review comments on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Feb 9, 2024
1 parent 1e0b10b commit b280e9d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,13 +1136,12 @@ def __mro_entries__(self, bases):
if self.__origin__ not in bases:
res.append(self.__origin__)

# Check if any base that occurs after us in the bases list is either
# itself a subclass of Generic, or something which will add a subclass
# of Generic via its __mro_entries__ (which includes another
# _BaseGenericAlias). If not, add Generic ourselves. The goal is to
# ensure that Generic (or a subclass) will appear exactly once in the
# final bases list. If we let it appear multiple times, we risk "can't
# form a consistent MRO" errors.
# Check if any base that occurs after us in `bases` is either itself a
# subclass of Generic, or something which will add a subclass of Generic
# to `__bases__` via its `__mro_entries__`. If not, add Generic
# ourselves. The goal is to ensure that Generic (or a subclass) will
# appear exactly once in the final bases tuple. If we let it appear
# multiple times, we risk "can't form a consistent MRO" errors.
i = bases.index(self)
for b in bases[i+1:]:
if isinstance(b, _BaseGenericAlias):
Expand Down

0 comments on commit b280e9d

Please sign in to comment.