[PATCH stable] doc: inspect.getargspec has been removed in Python 3.11

Yuya Nishihara yuya at tcha.org
Sun Feb 6 10:40:32 UTC 2022


On Sat, 05 Feb 2022 14:23:33 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1644066813 -3600
> #      Sat Feb 05 14:13:33 2022 +0100
> # Branch stable
> # Node ID e3c50cc1facafbd13120b7693155add1af9f94ed
> # Parent  01fde63b4eded708802bfd0d0d4cb4ecc5ff6e1c
> doc: inspect.getargspec has been removed in Python 3.11
> 
> Fix problem left over from 646002338365.
> 
> Reported for Fedora on https://bugzilla.redhat.com/show_bug.cgi?id=2022252#c2 .
> 
> diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py
> --- a/doc/hgmanpage.py
> +++ b/doc/hgmanpage.py
> @@ -177,7 +177,11 @@ class Translator(nodes.NodeVisitor):
>          nodes.NodeVisitor.__init__(self, document)
>          self.settings = settings = document.settings
>          lcode = settings.language_code
> -        arglen = len(inspect.getargspec(languages.get_language)[0])
> +        try:
> +            getfullargspec = inspect.getfullargspec
> +        except:  # Python 2
           ^^^^^^
check-code complains about naked except clause.

I think it's okay to drop support for old docutils. cdda48c93676 says this
hack is for Docutils < 0.8.



More information about the Mercurial-devel mailing list