Skip to content

Commit 63bd4b8

Browse files
committed
Use warnings.warn and deprecation warning
1 parent d20cb96 commit 63bd4b8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

sphinx/domains/python.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,12 @@ def handle_signature(self, sig: str, signode: desc_signature) -> Tuple[str, str]
496496
sig_prefix = self.get_signature_prefix(sig)
497497
if sig_prefix:
498498
if type(sig_prefix) is str:
499-
logger.warning(
500-
"Python directive get_signature_prefix() returns a str ('{}')"
501-
" instead of a list of nodes (changed in 4.3).".format(sig_prefix),
502-
location=signode)
499+
warnings.warn(
500+
"Python directive method get_signature_prefix()"
501+
" returning a string is deprecated."
502+
" It must now return a list of nodes."
503+
" Return value was '{}'.".format(sig_prefix),
504+
RemovedInSphinx50Warning)
503505
signode += addnodes.desc_annotation(sig_prefix, '', # type: ignore
504506
nodes.Text(sig_prefix)) # type: ignore
505507
else:

0 commit comments

Comments
 (0)