File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -470,10 +470,7 @@ def parse_pos_only(self) -> None:
470
470
argname_fmt = 'PyTuple_GET_ITEM(args, %d)'
471
471
472
472
if self .vararg != NO_VARARG :
473
- if self .max_pos == 0 :
474
- self .declarations = "Py_ssize_t nvararg = %s;" % nargs
475
- else :
476
- self .declarations = "Py_ssize_t nvararg = Py_MAX(%s - %d, 0);" % (nargs , self .max_pos )
473
+ self .declarations = f"Py_ssize_t nvararg = { nargs } - { self .max_pos } ;"
477
474
else :
478
475
self .declarations = ""
479
476
@@ -525,17 +522,13 @@ def parse_pos_only(self) -> None:
525
522
use_parser_code = True
526
523
for i , p in enumerate (self .parameters ):
527
524
if p .is_vararg ():
525
+ var = p .converter .parser_name
528
526
if self .fastcall :
529
- parser_code .append (libclinic .normalize_snippet ("""
530
- %s = args + %s;
531
- """ % (
532
- p .converter .parser_name ,
533
- self .vararg
534
- ), indent = 4 ))
527
+ code = f"{ var } = args + { self .vararg } ;"
535
528
else :
536
- parser_code . append ( libclinic . normalize_snippet ( "" "
537
- %s = _PyTuple_CAST(args)->ob_item;
538
- """ % p . converter . parser_name , indent = 4 ) )
529
+ code = f" { var } = _PyTuple_CAST(args)->ob_item; "
530
+ formatted_code = libclinic . normalize_snippet ( code , indent = 4 )
531
+ parser_code . append ( formatted_code )
539
532
continue
540
533
541
534
displayname = p .get_displayname (i + 1 )
You can’t perform that action at this time.
0 commit comments