Skip to content

Commit 39e39af

Browse files
mchehabJonathan Corbet
authored andcommitted
scripts: kdoc: make it backward-compatible with Python 3.7
There was a change at kdoc that ended breaking compatibility with Python 3.7: str.removesuffix() was introduced on version 3.9. Restore backward compatibility. Reported-by: Akira Yokosawa <[email protected]> Closes: https://lore.kernel.org/linux-doc/[email protected]/ Fixes: 27ad33b ("kernel-doc: Fix symbol matching for dropped suffixes") Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Link: https://lore.kernel.org/r/d13058d285838ac2bc04c492e60531c013a8a919.1752218291.git.mchehab+huawei@kernel.org
1 parent 7740f9d commit 39e39af

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/lib/kdoc/kdoc_parser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,9 @@ def process_export(function_set, line):
11201120
# Found an export, trim out any special suffixes
11211121
#
11221122
for suffix in suffixes:
1123-
symbol = symbol.removesuffix(suffix)
1123+
# Be backward compatible with Python < 3.9
1124+
if symbol.endswith(suffix):
1125+
symbol = symbol[:-len(suffix)]
11241126
function_set.add(symbol)
11251127
return True
11261128

0 commit comments

Comments
 (0)