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

Mads Kiilerich mads at kiilerich.com
Mon Feb 7 14:56:04 UTC 2022


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1644245153 -3600
#      Mon Feb 07 15:45:53 2022 +0100
# Branch stable
# Node ID 937db8e65dd5614cc4595cced61f2e21026d3be3
# Parent  01fde63b4eded708802bfd0d0d4cb4ecc5ff6e1c
doc: inspect.getargspec has been removed in Python 3.11

Fixed by dropping the inspection introduced in cdda48c93676. The 2nd "reporter"
parameter to docutils.languages.get_language has been available since 0.8 more
than 10 years ago.

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
@@ -45,7 +45,6 @@ from __future__ import absolute_import
 
 __docformat__ = 'reStructuredText'
 
-import inspect
 import re
 
 from docutils import (
@@ -177,13 +176,7 @@ 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])
-        if arglen == 2:
-            self.language = languages.get_language(
-                lcode, self.document.reporter
-            )
-        else:
-            self.language = languages.get_language(lcode)
+        self.language = languages.get_language(lcode, self.document.reporter)
         self.head = []
         self.body = []
         self.foot = []



More information about the Mercurial-devel mailing list