diff options
| author | Mauro Carvalho Chehab <[email protected]> | 2025-07-11 07:27:09 +0000 |
|---|---|---|
| committer | Jonathan Corbet <[email protected]> | 2025-07-17 21:29:53 +0000 |
| commit | 39e39af70d066029c788800ee07e0491e07eb081 (patch) | |
| tree | 7504a7e8d7dc9d1694307f07384de9012ecb02fd /scripts/lib | |
| parent | docs: kernel-doc: emit warnings for ancient versions of Python (diff) | |
| download | kernel-39e39af70d066029c788800ee07e0491e07eb081.tar.gz kernel-39e39af70d066029c788800ee07e0491e07eb081.zip | |
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: 27ad33b6b349 ("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
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/kdoc/kdoc_parser.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py index 06f55f38d4a7..c3fe4bd5eab4 100644 --- a/scripts/lib/kdoc/kdoc_parser.py +++ b/scripts/lib/kdoc/kdoc_parser.py @@ -1120,7 +1120,9 @@ class KernelDoc: # Found an export, trim out any special suffixes # for suffix in suffixes: - symbol = symbol.removesuffix(suffix) + # Be backward compatible with Python < 3.9 + if symbol.endswith(suffix): + symbol = symbol[:-len(suffix)] function_set.add(symbol) return True |
