Skip to content

Commit

Permalink
Merge pull request #9833 from jakobandersen/py_get_signature_prefix
Browse files Browse the repository at this point in the history
Make fallback for changed get_signature_prefix()
  • Loading branch information
tk0miya committed Nov 10, 2021
2 parents 096e286 + 63bd4b8 commit 5999cdb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sphinx/domains/python.py
Expand Up @@ -495,7 +495,17 @@ def handle_signature(self, sig: str, signode: desc_signature) -> Tuple[str, str]

sig_prefix = self.get_signature_prefix(sig)
if sig_prefix:
signode += addnodes.desc_annotation(str(sig_prefix), '', *sig_prefix)
if type(sig_prefix) is str:
warnings.warn(
"Python directive method get_signature_prefix()"
" returning a string is deprecated."
" It must now return a list of nodes."
" Return value was '{}'.".format(sig_prefix),
RemovedInSphinx50Warning)
signode += addnodes.desc_annotation(sig_prefix, '', # type: ignore
nodes.Text(sig_prefix)) # type: ignore
else:
signode += addnodes.desc_annotation(str(sig_prefix), '', *sig_prefix)

if prefix:
signode += addnodes.desc_addname(prefix, prefix)
Expand Down

0 comments on commit 5999cdb

Please sign in to comment.