diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-11-11 02:05:37 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-11 02:05:37 +0900 |
commit | 5999cdb10dc92fdea71685c20824cbc84807712c (patch) | |
tree | d44349787da53bc741844bf7570cb52fd513c686 | |
parent | 096e28693edb8db078d828ff403380bd27f47e32 (diff) | |
parent | 63bd4b8062eaa65f107ce0b5066f8c7229f1c63c (diff) | |
download | sphinx-git-5999cdb10dc92fdea71685c20824cbc84807712c.tar.gz |
Merge pull request #9833 from jakobandersen/py_get_signature_prefix
Make fallback for changed get_signature_prefix()
-rw-r--r-- | sphinx/domains/python.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index fd6a78892..46a67b4ea 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -495,7 +495,17 @@ class PyObject(ObjectDescription[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) |