Merge branch '4.x'

This commit is contained in:
Takeshi KOMIYA 2021-10-31 15:44:02 +09:00
commit b32d4b500a
32 changed files with 141 additions and 69 deletions

View File

@ -85,6 +85,8 @@ Bugs fixed
* #9755: autodoc: memory addresses are shown for aliases
* #9752: autodoc: Failed to detect type annotation for slots attribute
* #9756: autodoc: Crashed if classmethod does not have __func__ attribute
* #9757: autodoc: :confval:`autodoc_inherit_docstrings` does not effect to
overriden classmethods
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
is not 'py'
* #9670: html: Fix download file with special characters
@ -97,8 +99,12 @@ Bugs fixed
* #9678: linkcheck: file extension was shown twice in warnings
* #9697: py domain: An index entry with parens was registered for ``py:method``
directive with ``:property:`` option
* #9775: py domain: Literal typehint was converted to a cross reference when
:confval:`autodoc_typehints='description'`
* #9708: needs_extension failed to check double-digit version correctly
* #9688: Fix :rst:dir:`code`` does not recognize ``:class:`` option
* #9733: Fix for logging handler flushing warnings in the middle of the docs
build
Testing
--------

View File

@ -353,17 +353,21 @@ class PyXrefMixin:
split_contnode = bool(contnode and contnode.astext() == target)
in_literal = False
results = []
for sub_target in filter(None, sub_targets):
if split_contnode:
contnode = nodes.Text(sub_target)
if delims_re.match(sub_target):
if in_literal or delims_re.match(sub_target):
results.append(contnode or innernode(sub_target, sub_target))
else:
results.append(self.make_xref(rolename, domain, sub_target,
innernode, contnode, env, inliner, location))
if sub_target in ('Literal', 'typing.Literal'):
in_literal = True
return results

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Catalan (http://www.transifex.com/sphinx-doc/sphinx-1/language/ca/)\n"
@ -2867,7 +2867,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2898,12 +2898,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Greek (http://www.transifex.com/sphinx-doc/sphinx-1/language/el/)\n"
@ -2869,7 +2869,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2900,12 +2900,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Estonian (http://www.transifex.com/sphinx-doc/sphinx-1/language/et/)\n"
@ -2870,7 +2870,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2901,12 +2901,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Croatian (http://www.transifex.com/sphinx-doc/sphinx-1/language/hr/)\n"
@ -2867,7 +2867,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2898,12 +2898,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -13,7 +13,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Hungarian (http://www.transifex.com/sphinx-doc/sphinx-1/language/hu/)\n"
@ -2872,7 +2872,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2903,12 +2903,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Polish (http://www.transifex.com/sphinx-doc/sphinx-1/language/pl/)\n"
@ -2870,7 +2870,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2901,12 +2901,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Slovak (http://www.transifex.com/sphinx-doc/sphinx-1/language/sk/)\n"
@ -2869,7 +2869,7 @@ msgid ""
msgstr "chýbajúci atribút spomenutý vo voľbe :members: : modul %s, atribút %s"
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2900,12 +2900,12 @@ msgstr "alias pre TypeVar(%s)"
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr "Neplatné __slots__ nájdené v %s. Ignorované."
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Slovenian (http://www.transifex.com/sphinx-doc/sphinx-1/language/sl/)\n"
@ -2866,7 +2866,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2897,12 +2897,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx 4.3.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -2884,7 +2884,7 @@ msgid "missing attribute mentioned in :members: option: module %s, attribute %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2915,12 +2915,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of "
"\"alphabetic\". Please update your setting."

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Albanian (http://www.transifex.com/sphinx-doc/sphinx-1/language/sq/)\n"
@ -2867,7 +2867,7 @@ msgid ""
msgstr "u përmend atribut që mungon në :members: mundësi: modul %s, atributi %s"
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr "Su arrit të merret një nënshkrim funksioni për %s: %s"
@ -2898,12 +2898,12 @@ msgstr "alias për TypeVar(%s)"
msgid "Failed to get a method signature for %s: %s"
msgstr "Su arrit të merre një nënshkrim metode për %s: %s"
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr "U gjet __slots__ i pavlefshëm në %s. U shpërfill."
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Serbian (Serbia) (http://www.transifex.com/sphinx-doc/sphinx-1/language/sr_RS/)\n"
@ -2866,7 +2866,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2897,12 +2897,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Turkish (http://www.transifex.com/sphinx-doc/sphinx-1/language/tr/)\n"
@ -2870,7 +2870,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2901,12 +2901,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-10-25 16:47+0000\n"
"POT-Creation-Date: 2021-10-31 00:10+0000\n"
"PO-Revision-Date: 2021-10-10 00:10+0000\n"
"Last-Translator: Komiya Takeshi <i.tkomiya@gmail.com>\n"
"Language-Team: Cantonese (http://www.transifex.com/sphinx-doc/sphinx-1/language/yue/)\n"
@ -2866,7 +2866,7 @@ msgid ""
msgstr ""
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#: sphinx/ext/autodoc/__init__.py:2743
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""
@ -2897,12 +2897,12 @@ msgstr ""
msgid "Failed to get a method signature for %s: %s"
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2349
#: sphinx/ext/autodoc/__init__.py:2348
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""
#: sphinx/ext/autodoc/__init__.py:2778
#: sphinx/ext/autodoc/__init__.py:2786
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."

View File

@ -296,9 +296,9 @@ class Locale(SphinxTransform):
lst.append(new)
is_autofootnote_ref = NodeMatcher(nodes.footnote_reference, auto=Any)
old_foot_refs: List[nodes.footnote_reference] = node.traverse(is_autofootnote_ref)
new_foot_refs: List[nodes.footnote_reference] = patch.traverse(is_autofootnote_ref)
if len(list(old_foot_refs)) != len(list(new_foot_refs)):
old_foot_refs: List[nodes.footnote_reference] = list(node.traverse(is_autofootnote_ref)) # NOQA
new_foot_refs: List[nodes.footnote_reference] = list(patch.traverse(is_autofootnote_ref)) # NOQA
if len(old_foot_refs) != len(new_foot_refs):
old_foot_ref_rawsources = [ref.rawsource for ref in old_foot_refs]
new_foot_ref_rawsources = [ref.rawsource for ref in new_foot_refs]
logger.warning(__('inconsistent footnote references in translated message.' +
@ -339,9 +339,9 @@ class Locale(SphinxTransform):
# * use translated refname for section refname.
# * inline reference "`Python <...>`_" has no 'refname'.
is_refnamed_ref = NodeMatcher(nodes.reference, refname=Any)
old_refs: List[nodes.reference] = node.traverse(is_refnamed_ref)
new_refs: List[nodes.reference] = patch.traverse(is_refnamed_ref)
if len(list(old_refs)) != len(list(new_refs)):
old_refs: List[nodes.reference] = list(node.traverse(is_refnamed_ref))
new_refs: List[nodes.reference] = list(patch.traverse(is_refnamed_ref))
if len(old_refs) != len(new_refs):
old_ref_rawsources = [ref.rawsource for ref in old_refs]
new_ref_rawsources = [ref.rawsource for ref in new_refs]
logger.warning(__('inconsistent references in translated message.' +
@ -366,10 +366,10 @@ class Locale(SphinxTransform):
# refnamed footnote should use original 'ids'.
is_refnamed_footnote_ref = NodeMatcher(nodes.footnote_reference, refname=Any)
old_foot_refs = node.traverse(is_refnamed_footnote_ref)
new_foot_refs = patch.traverse(is_refnamed_footnote_ref)
old_foot_refs = list(node.traverse(is_refnamed_footnote_ref))
new_foot_refs = list(patch.traverse(is_refnamed_footnote_ref))
refname_ids_map: Dict[str, List[str]] = {}
if len(list(old_foot_refs)) != len(list(new_foot_refs)):
if len(old_foot_refs) != len(new_foot_refs):
old_foot_ref_rawsources = [ref.rawsource for ref in old_foot_refs]
new_foot_ref_rawsources = [ref.rawsource for ref in new_foot_refs]
logger.warning(__('inconsistent footnote references in translated message.' +
@ -385,10 +385,10 @@ class Locale(SphinxTransform):
# citation should use original 'ids'.
is_citation_ref = NodeMatcher(nodes.citation_reference, refname=Any)
old_cite_refs: List[nodes.citation_reference] = node.traverse(is_citation_ref)
new_cite_refs: List[nodes.citation_reference] = patch.traverse(is_citation_ref)
old_cite_refs: List[nodes.citation_reference] = list(node.traverse(is_citation_ref)) # NOQA
new_cite_refs: List[nodes.citation_reference] = list(patch.traverse(is_citation_ref)) # NOQA
refname_ids_map = {}
if len(list(old_cite_refs)) != len(list(new_cite_refs)):
if len(old_cite_refs) != len(new_cite_refs):
old_cite_ref_rawsources = [ref.rawsource for ref in old_cite_refs]
new_cite_ref_rawsources = [ref.rawsource for ref in new_cite_refs]
logger.warning(__('inconsistent citation references in translated message.' +
@ -405,10 +405,10 @@ class Locale(SphinxTransform):
# Original pending_xref['reftarget'] contain not-translated
# target name, new pending_xref must use original one.
# This code restricts to change ref-targets in the translation.
old_xrefs = node.traverse(addnodes.pending_xref)
new_xrefs = patch.traverse(addnodes.pending_xref)
old_xrefs = list(node.traverse(addnodes.pending_xref))
new_xrefs = list(patch.traverse(addnodes.pending_xref))
xref_reftarget_map = {}
if len(list(old_xrefs)) != len(list(new_xrefs)):
if len(old_xrefs) != len(new_xrefs):
old_xref_rawsources = [xref.rawsource for xref in old_xrefs]
new_xref_rawsources = [xref.rawsource for xref in new_xrefs]
logger.warning(__('inconsistent term references in translated message.' +

View File

@ -866,7 +866,9 @@ def getdoc(obj: Any, attrgetter: Callable = safe_getattr,
for basecls in getmro(cls):
meth = basecls.__dict__.get(name)
if meth and hasattr(meth, '__func__'):
return getdoc(meth.__func__)
doc = getdoc(meth.__func__)
if doc is not None or not allow_inherited:
return doc
doc = attrgetter(obj, '__doc__', None)
if ispartial(obj) and doc == obj.__class__.__doc__:

View File

@ -171,6 +171,11 @@ class MemoryHandler(logging.handlers.BufferingHandler):
def shouldFlush(self, record: logging.LogRecord) -> bool:
return False # never flush
def flush(self) -> None:
# suppress any flushes triggered by importing packages that flush
# all handlers at initialization time
pass
def flushTo(self, logger: logging.Logger) -> None:
self.acquire()
try:

View File

@ -1110,6 +1110,42 @@ def test_info_field_list_piped_type(app):
**{"py:module": "example", "py:class": "Class"})
def test_info_field_list_Literal(app):
text = (".. py:module:: example\n"
".. py:class:: Class\n"
"\n"
" :param age: blah blah\n"
" :type age: Literal['foo', 'bar', 'baz']\n")
doctree = restructuredtext.parse(app, text)
assert_node(doctree,
(nodes.target,
addnodes.index,
addnodes.index,
[desc, ([desc_signature, ([desc_annotation, ("class", desc_sig_space)],
[desc_addname, "example."],
[desc_name, "Class"])],
[desc_content, nodes.field_list, nodes.field, (nodes.field_name,
nodes.field_body)])]))
assert_node(doctree[3][1][0][0][1],
([nodes.paragraph, ([addnodes.literal_strong, "age"],
" (",
[pending_xref, addnodes.literal_emphasis, "Literal"],
[addnodes.literal_emphasis, "["],
[addnodes.literal_emphasis, "'foo'"],
[addnodes.literal_emphasis, ", "],
[addnodes.literal_emphasis, "'bar'"],
[addnodes.literal_emphasis, ", "],
[addnodes.literal_emphasis, "'baz'"],
[addnodes.literal_emphasis, "]"],
")",
" -- ",
"blah blah")],))
assert_node(doctree[3][1][0][0][1][0][2], pending_xref,
refdomain="py", reftype="class", reftarget="Literal",
**{"py:module": "example", "py:class": "Class"})
def test_info_field_list_var(app):
text = (".. py:class:: Class\n"
"\n"

View File

@ -677,6 +677,25 @@ def test_unpartial():
assert inspect.unpartial(func3) is func1
def test_getdoc_inherited_classmethod():
class Foo:
@classmethod
def meth(self):
"""
docstring
indented text
"""
class Bar(Foo):
@classmethod
def meth(self):
# inherited classmethod
pass
assert inspect.getdoc(Bar.meth, getattr, False, Bar, "meth") is None
assert inspect.getdoc(Bar.meth, getattr, True, Bar, "meth") == Foo.meth.__doc__
def test_getdoc_inherited_decorated_method():
class Foo:
def meth(self):