diff --git a/misc/analyze_cache.py b/misc/analyze_cache.py index 0a05493b77a3..f67e9b0ba753 100644 --- a/misc/analyze_cache.py +++ b/misc/analyze_cache.py @@ -77,6 +77,8 @@ def pluck(name: str, chunks: Iterable[JsonDict]) -> Iterable[JsonDict]: def report_counter(counter: Counter[str], amount: int | None = None) -> None: + if amount is None: + amount = len(counter) # default to the length of the counter if `amount` is None for name, count in counter.most_common(amount): print(f" {count: <8} {name}") print() diff --git a/mypy/mro.py b/mypy/mro.py index f34f3fa0c46d..01786c659428 100644 --- a/mypy/mro.py +++ b/mypy/mro.py @@ -32,8 +32,7 @@ def linearize_hierarchy( return info.mro bases = info.direct_base_classes() if not bases and info.fullname != "builtins.object" and obj_type is not None: - # Probably an error, add a dummy `object` base class, - # otherwise MRO calculation may spuriously fail. + # If no base classes are found, and obj_type is provided, we use obj_type to provide a base. bases = [obj_type().type] lin_bases = [] for base in bases: