Commit 39e39af7 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet
Browse files

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: default avatarAkira Yokosawa <akiyks@gmail.com>
Closes: https://lore.kernel.org/linux-doc/57be9f77-9a94-4cde-aacb-184cae111506@gmail.com/


Fixes: 27ad33b6 ("kernel-doc: Fix symbol matching for dropped suffixes")
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/d13058d285838ac2bc04c492e60531c013a8a919.1752218291.git.mchehab+huawei@kernel.org
parent 7740f9db
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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