mirror of
https://github.com/python/cpython.git
synced 2025-11-01 22:21:35 +00:00
gh-136434: Fix docs generation of UnboundItem in subinterpreters (#136435)
This commit is contained in:
parent
975b57d945
commit
3343fce05a
2 changed files with 14 additions and 7 deletions
|
|
@ -40,16 +40,21 @@ class UnboundItem:
|
||||||
|
|
||||||
@classonly
|
@classonly
|
||||||
def singleton(cls, kind, module, name='UNBOUND'):
|
def singleton(cls, kind, module, name='UNBOUND'):
|
||||||
doc = cls.__doc__.replace('cross-interpreter container', kind)
|
doc = cls.__doc__
|
||||||
doc = doc.replace('cross-interpreter', kind)
|
if doc:
|
||||||
|
doc = doc.replace(
|
||||||
|
'cross-interpreter container', kind,
|
||||||
|
).replace(
|
||||||
|
'cross-interpreter', kind,
|
||||||
|
)
|
||||||
subclass = type(
|
subclass = type(
|
||||||
f'Unbound{kind.capitalize()}Item',
|
f'Unbound{kind.capitalize()}Item',
|
||||||
(cls,),
|
(cls,),
|
||||||
dict(
|
{
|
||||||
_MODULE=module,
|
"_MODULE": module,
|
||||||
_NAME=name,
|
"_NAME": name,
|
||||||
__doc__=doc,
|
"__doc__": doc,
|
||||||
),
|
},
|
||||||
)
|
)
|
||||||
return object.__new__(subclass)
|
return object.__new__(subclass)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix docs generation of ``UnboundItem`` in :mod:`concurrent.interpreters`
|
||||||
|
when running with :option:`-OO`.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue