From 55e3c631973b71e49b78a2dd1a263d4c3b778e3a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 27 Aug 2023 20:43:50 -0400 Subject: [PATCH] Revert "Filter out parameterized types. Fixes #2." This reverts commit e34c9233a43a9edc15e85f989d72a421898c8308, no longer needed on supported Pythons. --- singledispatch/__init__.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/singledispatch/__init__.py b/singledispatch/__init__.py index f0bd42d..2ec337a 100644 --- a/singledispatch/__init__.py +++ b/singledispatch/__init__.py @@ -117,7 +117,7 @@ def is_strict_base(typ): mro = [] for typ in types: found = [] - for sub in filter(_safe, typ.__subclasses__()): + for sub in typ.__subclasses__(): if sub not in bases and issubclass(cls, sub): found.append([s for s in sub.__mro__ if s in type_set]) if not found: @@ -132,13 +132,6 @@ def is_strict_base(typ): return _c3_mro(cls, abcs=mro) -def _safe(class_): - """ - Return if the class is safe for testing as subclass. Ref #2. - """ - return not getattr(class_, '__origin__', None) - - def _find_impl(cls, registry): """Returns the best matching implementation from *registry* for type *cls*.