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

Mads Kiilerich mads at kiilerich.com
Sat Feb 5 13:23:33 UTC 2022


# 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
+            getfullargspec = inspect.getargspec
+        arglen = len(getfullargspec(languages.get_language)[0])
         if arglen == 2:
             self.language = languages.get_language(
                 lcode, self.document.reporter



More information about the Mercurial-devel mailing list