[Python-checkins] gh-104683: Argument Clinic: Remove unreachable code from _module_and_class() (#108092)

erlend-aasland webhook-mailer at python.org
Thu Aug 17 14:16:12 EDT 2023


https://github.com/python/cpython/commit/292a22bdc22f2aa70c96e9e53ca6d6b0c5f8d5bf
commit: 292a22bdc22f2aa70c96e9e53ca6d6b0c5f8d5bf
branch: main
author: Erlend E. Aasland <erlend at python.org>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-08-17T18:16:08Z
summary:

gh-104683: Argument Clinic: Remove unreachable code from _module_and_class() (#108092)

'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.

files:
M Tools/clinic/clinic.py

diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 9f7c47430772f..1593dc49e07e1 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -2427,8 +2427,6 @@ def _module_and_class(
                 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)



More information about the Python-checkins mailing list