Skip to content
Prev Previous commit
Next Next commit
Pull in main
  • Loading branch information
erlend-aasland committed Aug 15, 2023
commit f2aefff4ce74e49e806214444d2d3315f99e417c
15 changes: 15 additions & 0 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4848,6 +4848,21 @@ def parse_names(line: str) -> tuple[str, str]:
fail(f"Illegal C basename: {c_basename!r}")
return full_name, c_basename

def update_function_kind(self, fullname: str) -> None:
fields = fullname.split('.')
name = fields.pop()
_, cls = self.clinic._module_and_class(fields)
if name in unsupported_special_methods:
fail(f"{name!r} is a special method and cannot be converted to Argument Clinic!")
if name == '__new__':
if (self.kind is not CLASS_METHOD) or (not cls):
fail("'__new__' must be a class method!")
self.kind = METHOD_NEW
elif name == '__init__':
if (self.kind is not CALLABLE) or (not cls):
fail("'__init__' must be a normal method, not a class or static method!")
self.kind = METHOD_INIT

def state_modulename_name(self, line: str) -> None:
# looking for declaration, which establishes the leftmost column
# line should be
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.