Make fallback for changed get_signature_prefix()#9833
Make fallback for changed get_signature_prefix()#9833tk0miya merged 3 commits intosphinx-doc:4.xfrom
Conversation
| if sig_prefix: | ||
| signode += addnodes.desc_annotation(str(sig_prefix), '', *sig_prefix) | ||
| if type(sig_prefix) is str: | ||
| logger.warning( |
There was a problem hiding this comment.
Could you use warnings.warn() instead? It can describe what version this fallback will be dropped.
There was a problem hiding this comment.
Sure. Removed in v5 or v6?
Is there a way to automatically attach the location that triggered this? (the location=signode that logger.warning() accepts)?
There was a problem hiding this comment.
Our deprecation policy is "the deprecated feature will work during 2 MAJOR releases at least". So it will be removed in v6.0.
https://www.sphinx-doc.org/en/master/internals/release-process.html#deprecation-policy
Is there a way to automatically attach the location that triggered this?
No way to do that. It would be nice if we can improve it in the future.
|
Thank you for update. Merging. I'll fix the warning type from my side. |
Fix the type of deprecation warning for get_signature_prefix (refs: #9833)
|
Great, thanks! |
Feature or Bugfix
Purpose
In #9672 the signature of
get_signature_prefix()in the Python domain was changed to return a list of docutils nodes instead of string. Based on #9832 it looks like some extensions (https://pypi.org/project/autodoc-pydantic/) indeed overwrites this method.This PR adds a fallback check for
strand warns about the changed interface.Detail
This is quick and dirty PR to get started. I guess it should use one of the deprecation facilities, but I'm not exactly sure.
Relates
Fixes #9832