[PATCH] makedocbook: Avoid python deprecation warnings

Jon Turney jon.turney@dronecode.org.uk
Sun Apr 27 18:05:33 GMT 2025


Avoid some deprecation warnings with recent python:

> .../newlib/doc/makedocbook.py:201: DeprecationWarning: 'count' is passed as positional argument
> .../newlib/doc/makedocbook.py:566: DeprecationWarning: 'count' is passed as positional argument
---
 newlib/doc/makedocbook.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/doc/makedocbook.py b/newlib/doc/makedocbook.py
index 9c5615f22..b5ef5962b 100755
--- a/newlib/doc/makedocbook.py
+++ b/newlib/doc/makedocbook.py
@@ -198,7 +198,7 @@ def function(c, l):
     descr = line_markup_convert(', '.join(descrlist))
 
     # fpclassify includes an 'and' we need to discard
-    namelist = map(lambda v: re.sub(r'^and ', r'', v.strip(), 1), namelist)
+    namelist = map(lambda v: re.sub(r'^and ', r'', v.strip(), count=1), namelist)
     # strip off << >> surrounding name
     namelist = map(lambda v: v.strip().lstrip('<').rstrip('>'), namelist)
     # instantiate list to make it subscriptable
@@ -563,7 +563,7 @@ def t_TABLEEND(t):
 
 def t_ITEM(t):
     r'o\s.*\n'
-    t.value = re.sub(r'o\s', r'', lexer.lexmatch.group(0), 1)
+    t.value = re.sub(r'o\s', r'', lexer.lexmatch.group(0), count=1)
     t.value = line_markup_convert(t.value)
     return t
 
-- 
2.45.1



More information about the Newlib mailing list