def render_option_group_parsing(
self,
f: Function,
- template_dict: TemplateDict
+ template_dict: TemplateDict,
+ limited_capi: bool,
) -> None:
# positional only, grouped, optional arguments!
# can be optional on the left or right.
count_min = sys.maxsize
count_max = -1
- add("switch (PyTuple_GET_SIZE(args)) {\n")
+ if limited_capi:
+ nargs = 'PyTuple_Size(args)'
+ else:
+ nargs = 'PyTuple_GET_SIZE(args)'
+ add(f"switch ({nargs}) {{\n")
for subset in permute_optional_groups(left, required, right):
count = len(subset)
count_min = min(count_min, count)
template_dict['unpack_max'] = str(unpack_max)
if has_option_groups:
- self.render_option_group_parsing(f, template_dict)
+ self.render_option_group_parsing(f, template_dict,
+ limited_capi=clinic.limited_capi)
# buffers, not destination
for name, destination in clinic.destination_buffers.items():