[PATCH] makedocbook: Avoid python deprecation warnings

Jeff Johnston jjohnstn@redhat.com
Mon Apr 28 22:23:51 GMT 2025


Patch applied.  Thanks.

-- Jeff J.

On Sun, Apr 27, 2025 at 2:06 PM Jon Turney <jon.turney@dronecode.org.uk>
wrote:

> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/newlib/attachments/20250428/9e0bba09/attachment.htm>


More information about the Newlib mailing list