Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scripts/lib/kdoc/kdoc_parser.py: fix Python compat with < v3.13

- str.replace count was introduced only in Python 3.13;
- before Python 3.13, f-string dict arguments can't use the same
delimiter of the main string.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/e2b8e8361294558dae09236e4b8fbea5d86be5a3.1744106242.git.mchehab+huawei@kernel.org

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
78ea748f 485f6f79

+6 -6
+4 -4
scripts/lib/kdoc/kdoc_output.py
··· 647 647 sectionlist = args.get('sectionlist', []) 648 648 sections = args.get('sections', {}) 649 649 650 - self.data += f'.TH "{args['function']}" 9 "{args['function']}" "{self.man_date}" "Kernel Hacker\'s Manual" LINUX' + "\n" 650 + self.data += f'.TH "{args["function"]}" 9 "{args["function"]}" "{self.man_date}" "Kernel Hacker\'s Manual" LINUX' + "\n" 651 651 652 652 self.data += ".SH NAME\n" 653 653 self.data += f"{args['function']} \\- {args['purpose']}\n" 654 654 655 655 self.data += ".SH SYNOPSIS\n" 656 656 if args.get('functiontype', ''): 657 - self.data += f'.B "{args['functiontype']}" {args['function']}' + "\n" 657 + self.data += f'.B "{args["functiontype"]}" {args["function"]}' + "\n" 658 658 else: 659 - self.data += f'.B "{args['function']}' + "\n" 659 + self.data += f'.B "{args["function"]}' + "\n" 660 660 661 661 count = 0 662 662 parenth = "(" ··· 697 697 sectionlist = args.get('sectionlist', []) 698 698 sections = args.get('sections', {}) 699 699 700 - self.data += f'.TH "{args['module']}" 9 "enum {args['enum']}" "{self.man_date}" "API Manual" LINUX' + "\n" 700 + self.data += f'.TH "{args["module"]}" 9 "enum {args["enum"]}" "{self.man_date}" "API Manual" LINUX' + "\n" 701 701 702 702 self.data += ".SH NAME\n" 703 703 self.data += f"enum {args['enum']} \\- {args['purpose']}\n"
+2 -2
scripts/lib/kdoc/kdoc_parser.py
··· 1444 1444 1445 1445 r = Re(r'long\s+(sys_.*?),') 1446 1446 if r.search(proto): 1447 - proto = proto.replace(',', '(', count=1) 1447 + proto = Re(',').sub('(', proto, count=1) 1448 1448 elif is_void: 1449 - proto = proto.replace(')', '(void)', count=1) 1449 + proto = Re(r'\)').sub('(void)', proto, count=1) 1450 1450 1451 1451 # Now delete all of the odd-numbered commas in the proto 1452 1452 # so that argument types & names don't have a comma between them