Skip to content

Commit

Permalink
Use warnings.warn and deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobandersen committed Nov 9, 2021
1 parent d20cb96 commit 63bd4b8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sphinx/domains/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,12 @@ def handle_signature(self, sig: str, signode: desc_signature) -> 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:
Expand Down

0 comments on commit 63bd4b8

Please sign in to comment.