]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-136434: Fix docs generation of `UnboundItem` in subinterpreters (GH-136435...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 11 Jul 2025 12:57:52 +0000 (14:57 +0200)
committerGitHub <noreply@github.com>
Fri, 11 Jul 2025 12:57:52 +0000 (12:57 +0000)
gh-136434: Fix docs generation of `UnboundItem` in subinterpreters (GH-136435)
(cherry picked from commit 3343fce05acb29a772599ce586abd43edf40bae6)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/concurrent/interpreters/_crossinterp.py
Misc/NEWS.d/next/Library/2025-07-08-20-58-01.gh-issue-136434.uuJsjS.rst [new file with mode: 0644]

index f47eb693ac861c0721a04e6de130b06f2e581ab7..a5f46b20fbb4c561f2878a6bbdc1792ea3b46e4e 100644 (file)
@@ -40,16 +40,21 @@ class UnboundItem:
 
     @classonly
     def singleton(cls, kind, module, name='UNBOUND'):
-        doc = cls.__doc__.replace('cross-interpreter container', kind)
-        doc = doc.replace('cross-interpreter', kind)
+        doc = cls.__doc__
+        if doc:
+            doc = doc.replace(
+                'cross-interpreter container', kind,
+            ).replace(
+                'cross-interpreter', kind,
+            )
         subclass = type(
             f'Unbound{kind.capitalize()}Item',
             (cls,),
-            dict(
-                _MODULE=module,
-                _NAME=name,
-                __doc__=doc,
-            ),
+            {
+                "_MODULE": module,
+                "_NAME": name,
+                "__doc__": doc,
+            },
         )
         return object.__new__(subclass)
 
diff --git a/Misc/NEWS.d/next/Library/2025-07-08-20-58-01.gh-issue-136434.uuJsjS.rst b/Misc/NEWS.d/next/Library/2025-07-08-20-58-01.gh-issue-136434.uuJsjS.rst
new file mode 100644 (file)
index 0000000..951f571
--- /dev/null
@@ -0,0 +1,2 @@
+Fix docs generation of ``UnboundItem`` in :mod:`concurrent.interpreters`
+when running with :option:`-OO`.