Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Nov 6, 2024
1 parent 9080ed5 commit e38d94e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Modules/clinic/_testclinic.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Modules/gcmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ gc_get_referrers_impl(PyObject *module, PyObject *objs)
}

PyInterpreterState *interp = _PyInterpreterState_GET();
PyObject *result = _PyGC_GetReferrers(interp, objs);

return result;
return _PyGC_GetReferrers(interp, objs);
}

/* Append obj to list; return true if error (out of memory), false if OK. */
Expand Down
2 changes: 1 addition & 1 deletion Tools/clinic/libclinic/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def render(self, parameter: Parameter, data: CRenderData) -> None:
def length_name(self) -> str:
"""Computes the name of the associated "length" variable."""
assert self.length is not None
return self.parser_name.removeprefix(libclinic.CLINIC_PREFIX) + "_length"
return self.name + "_length"

# Why is this one broken out separately?
# For "positional-only" function parsing,
Expand Down
6 changes: 0 additions & 6 deletions Tools/clinic/libclinic/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,9 +1237,6 @@ class varpos_tuple_converter(CConverter):
format_unit = ''
c_default = 'NULL'

def converter_init(self) -> None:
pass

def cleanup(self) -> str:
return f"""Py_XDECREF({self.parser_name});\n"""

Expand All @@ -1252,9 +1249,6 @@ class varpos_array_converter(CConverter):
length = True
c_ignored_default = ''

def converter_init(self) -> None:
pass

def parse_arg(self, argname: str, displayname: str, *, limited_capi: bool) -> str | None:
raise AssertionError('should never be called')

Expand Down
2 changes: 1 addition & 1 deletion Tools/clinic/libclinic/parse_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def _parse_vararg(self) -> str:
size = 'nargs' if self.fastcall else 'PyTuple_GET_SIZE(args)'
if self.max_pos:
if min(self.pos_only, self.min_pos) < self.max_pos:
start = f'{start} + Py_MIN({size}, {self.max_pos})'
start = f'{size} > {self.max_pos} ? {start} + {self.max_pos} : {start}'
size = f'Py_MAX(0, {size} - {self.max_pos})'
else:
start = f'{start} + {self.max_pos}'
Expand Down

0 comments on commit e38d94e

Please sign in to comment.