proj/pkgcore/snakeoil:master commit in: src/snakeoil/dist/, /

"Arthur Zamarin" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786086953.2b6d53bf290cb24de4e631619187e90f884a2719.arthurzam@gentoo>
commit:     2b6d53bf290cb24de4e631619187e90f884a2719
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  7 07:15:53 2026 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  7 07:15:53 2026 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=2b6d53bf

dist.generate_man_rsts: fix positional rewriting under Python 3.14

ManConverter kept the positional rST rewrite as a class attribute built with
functools.partial, and called it as self.positional_re(x). Python 3.14 made
partial implement the descriptor protocol, so instance access now yields a
bound method: the call became pattern.sub(repl, self, x), putting the instance
in the string slot and the line in count, and every man page build died with
"TypeError: 'str' object cannot be interpreted as an integer". Sphinx surfaced
it as an ExtensionError from the builder-inited handler.

Closes: https://bugs.gentoo.org/957993
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 NEWS.rst                               | 9 +++++++++
 src/snakeoil/dist/generate_man_rsts.py | 4 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/NEWS.rst b/NEWS.rst
index ea531bb..6dfe733 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -2,6 +2,15 @@
 Release Notes
 =============
 
+snakeoil 0.11.4 (unreleased)
+----------------------------
+
+- ``snakeoil.dist.generate_man_rsts``: fix man page generation failing under
+  Python 3.14 with ``TypeError: 'str' object cannot be interpreted as an
+  integer``, caused by ``functools.partial`` becoming a method descriptor
+  (Arthur Zamarin, https://bugs.gentoo.org/957993)
+
+
 snakeoil 0.11.3 (2026-07-30)
 ----------------------------
 

diff --git a/src/snakeoil/dist/generate_man_rsts.py b/src/snakeoil/dist/generate_man_rsts.py
index 62c2e82..aeecacf 100644
--- a/src/snakeoil/dist/generate_man_rsts.py
+++ b/src/snakeoil/dist/generate_man_rsts.py
@@ -3,7 +3,6 @@ import errno
 import os
 import re
 import sys
-from functools import partial
 from importlib import import_module
 from string import capwords
 from unittest.mock import patch
@@ -43,7 +42,6 @@ class ManConverter:
     """Convert argparse help docs into rST man pages."""
 
     positional_re = re.compile(r'^([^: \t]+)')
-    positional_re = partial(positional_re.sub, r':\g<1>:')
 
     arg_enumeration_re = re.compile(r'{([^}]+)}')
 
@@ -139,7 +137,7 @@ class ManConverter:
             l.extend(_rst_header(self.header_char, action_group.title))
             if action_group.description:
                 l.extend(doc_dedent(action_group.description).split("\n"))
-            l.extend(self.positional_re(x) for x in data.split("\n"))
+            l.extend(self.positional_re.sub(r':\g<1>:', x) for x in data.split("\n"))
             l.append('')
         return l
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.