Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
  • Loading branch information
corona10 and erlend-aasland authored Dec 10, 2023
commit 2a8c3de295a67157b80fe27d659399175553b9ba
7 changes: 4 additions & 3 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ def parser_body(

parsearg: str | None
if f.kind in {GETTER, SETTER} and len(parameters) > 0:
Comment thread
corona10 marked this conversation as resolved.
Outdated
raise RuntimeError("@getter, @setter should not define paramters")
fail("neither @getter nor @setter can define parameters")
Comment thread
AlexWaygood marked this conversation as resolved.
Outdated

if not parameters:
parser_code: list[str] | None
Expand Down Expand Up @@ -1978,7 +1978,7 @@ def render_function(
template_dict['c_basename'] = f.c_basename + "_get"
elif f.kind is SETTER:
template_dict['c_basename'] = f.c_basename + "_set"
# TODO: Improve handling pararms better way.
# Implicitly add the setter value parameter.
data.impl_parameters.append("PyObject *value")
Comment thread
corona10 marked this conversation as resolved.
data.impl_arguments.append("value")
else:
Expand All @@ -1994,6 +1994,7 @@ def render_function(

f.return_converter.render(f, data)
if f.kind is SETTER:
# All setters return an int.
template_dict['impl_return_type'] = 'int'
Comment thread
corona10 marked this conversation as resolved.
else:
template_dict['impl_return_type'] = f.return_converter.type
Expand Down Expand Up @@ -5375,7 +5376,7 @@ def at_critical_section(self, *args: str) -> None:

def at_getter(self) -> None:
if self.kind in (GETTER, SETTER):
fail("@getter and @setter can not be declared at once")
fail("only one of @getter or @setter can be used")
self.kind = GETTER

def at_setter(self) -> None:
Expand Down