8000 gh-136434: Fix docs generation of `UnboundItem` in subinterpreters (#… · python/cpython@3343fce · GitHub
[go: up one dir, main page]

Skip to content

Commit 3343fce

Browse files
authored
gh-136434: Fix docs generation of UnboundItem in subinterpreters (#136435)
1 parent 975b57d commit 3343fce

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Lib/concurrent/interpreters/_crossinterp.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,21 @@ class UnboundItem:
4040

4141
@classonly
4242
def singleton(cls, kind, module, name='UNBOUND'):
43-
doc = cls.__doc__.replace('cross-interpreter container', kind)
44-
doc = doc.replace('cross-interpreter', kind)
43+
doc = cls.__doc__
44+
if doc:
45+
doc = doc.replace(
46+
'cross-interpreter container', kind,
47+
).replace(
48+
'cross-interpreter', kind,
49+
)
4550
subclass = type(
4651
f'Unbound{kind.capitalize()}Item',
4752
(cls,),
48-
dict(
49-
_MODULE=module,
50-
_NAME=name,
51-
__doc__=doc,
52-
),
53+
{
54+
"_MODULE": module,
55+
"_NAME": name,
56+
"__doc__": doc,
57+
},
5358
)
5459
return object.__new__(subclass)
5560

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix docs generation of ``UnboundItem`` in :mod:`concurrent.interpreters`
2+
when running with :option:`-OO`.

0 commit comments

Comments
 (0)
0