]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104683: Argument Clinic: Remove unreachable code from _module_and_class() (#108092)
authorErlend E. Aasland <erlend@python.org>
Thu, 17 Aug 2023 18:16:08 +0000 (20:16 +0200)
committerGitHub <noreply@github.com>
Thu, 17 Aug 2023 18:16:08 +0000 (18:16 +0000)
'not hasattr(parent, "classes")' is always false, since 'parent' is an
instance of either the Module, Class, or Clinic classes, and all of
them has a "classes" attribute.

Tools/clinic/clinic.py

index 9f7c47430772f75ce8348a909b1e953bc7c2eb27..1593dc49e07e1ffb3389ec9740dccaae05a40f64 100755 (executable)
@@ -2427,8 +2427,6 @@ impl_definition block
                 if child:
                     parent = module = child
                     continue
-            if not hasattr(parent, 'classes'):
-                return module, cls
             child = parent.classes.get(field)
             if not child:
                 fullname = ".".join(so_far)