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

login
register
mail settings
Submitter Mads Kiilerich
Date Feb. 7, 2022, 2:56 p.m.
Message ID <937db8e65dd5614cc459.1644245764@xps>
Download mbox | patch
Permalink /patch/50473/
State New
Headers show

Comments

Mads Kiilerich - Feb. 7, 2022, 2:56 p.m.
# HG changeset patch
# User Mads Kiilerich <mads@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 .
Yuya Nishihara - Feb. 8, 2022, 10:06 a.m.
On Mon, 07 Feb 2022 15:56:04 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads@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

Queued for stable, thanks.

Patch

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 = []