Skip to content

Commit be244f2

Browse files
Address Nikita's review
1 parent 2e6bc17 commit be244f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Tools/clinic/clinic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5158,9 +5158,8 @@ def normalize_function_kind(self, fullname: str) -> None:
51585158
fail(f"{name!r} must be a normal method; got '{self.kind}'!")
51595159
if name == '__new__' and (self.kind is not CLASS_METHOD or not cls):
51605160
fail("'__new__' must be a class method!")
5161-
if self.kind in {GETTER, SETTER}:
5162-
if not cls:
5163-
fail("@getter and @setter must be methods")
5161+
if self.kind in {GETTER, SETTER} and not cls:
5162+
fail("@getter and @setter must be methods")
51645163

51655164
# Normalise self.kind.
51665165
if name == '__new__':
@@ -5200,8 +5199,9 @@ def parse_cloned_function(self, names: FunctionNames, existing: str) -> None:
52005199
fields = [x.strip() for x in existing.split('.')]
52015200
function_name = fields.pop()
52025201
module, cls = self.clinic._module_and_class(fields)
5202+
parent = module or cls
52035203

5204-
for existing_function in (cls or module).functions:
5204+
for existing_function in parent.functions:
52055205
if existing_function.name == function_name:
52065206
break
52075207
else:

0 commit comments

Comments
 (0)