summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2025-07-11 12:57:52 (GMT)
committerGitHub <noreply@github.com>2025-07-11 12:57:52 (GMT)
commita464c4e2e844db0dc09bad4b29d2e765f8fbe9ab (patch)
treeb01e8e53a10a21ccb2316d44f7782acf38b276e6
parentfdad31924c57f30056c69dca382e9159e90b837f (diff)
downloadcpython-a464c4e2e844db0dc09bad4b29d2e765f8fbe9ab.zip
cpython-a464c4e2e844db0dc09bad4b29d2e765f8fbe9ab.tar.gz
cpython-a464c4e2e844db0dc09bad4b29d2e765f8fbe9ab.tar.bz2
[3.14] gh-136434: Fix docs generation of `UnboundItem` in subinterpreters (GH-136435) (#136540)
gh-136434: Fix docs generation of `UnboundItem` in subinterpreters (GH-136435) (cherry picked from commit 3343fce05acb29a772599ce586abd43edf40bae6) Co-authored-by: sobolevn <mail@sobolevn.me>
-rw-r--r--Lib/concurrent/interpreters/_crossinterp.py19
-rw-r--r--Misc/NEWS.d/next/Library/2025-07-08-20-58-01.gh-issue-136434.uuJsjS.rst2
2 files changed, 14 insertions, 7 deletions
diff --git a/Lib/concurrent/interpreters/_crossinterp.py b/Lib/concurrent/interpreters/_crossinterp.py
index f47eb693a..a5f46b2 100644
--- a/Lib/concurrent/interpreters/_crossinterp.py
+++ b/Lib/concurrent/interpreters/_crossinterp.py
@@ -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
index 0000000..951f571
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-07-08-20-58-01.gh-issue-136434.uuJsjS.rst
@@ -0,0 +1,2 @@
+Fix docs generation of ``UnboundItem`` in :mod:`concurrent.interpreters`
+when running with :option:`-OO`.