summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Lykke Andersen <Jakob@caput.dk>2021-11-09 20:37:34 +0100
committerJakob Lykke Andersen <Jakob@caput.dk>2021-11-09 20:37:34 +0100
commit63bd4b8062eaa65f107ce0b5066f8c7229f1c63c (patch)
treea8b7331d1ef920eb778874431e8c617fa2cae7ef
parentd20cb96773bd89e58da21f4996c20679dfb129e9 (diff)
downloadsphinx-git-63bd4b8062eaa65f107ce0b5066f8c7229f1c63c.tar.gz
Use warnings.warn and deprecation warning
-rw-r--r--sphinx/domains/python.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
index 402bdfc9f..46a67b4ea 100644
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -496,10 +496,12 @@ class PyObject(ObjectDescription[Tuple[str, str]]):
sig_prefix = self.get_signature_prefix(sig)
if sig_prefix:
if type(sig_prefix) is str:
- logger.warning(
- "Python directive get_signature_prefix() returns a str ('{}')"
- " instead of a list of nodes (changed in 4.3).".format(sig_prefix),
- location=signode)
+ 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: