mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix py domain: rtype field could not handle "None" as a type (refs: #4946)
This commit is contained in:
parent
62dbe44858
commit
50188b570a
1
CHANGES
1
CHANGES
@ -42,6 +42,7 @@ Bugs fixed
|
||||
* autosummary: warnings of autosummary indicates wrong location (refs: #5146)
|
||||
* #5143: autodoc: crashed on inspecting dict like object which does not support
|
||||
sorting
|
||||
* #4946: py domain: rtype field could not handle "None" as a type
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -148,7 +148,15 @@ class PyXrefMixin(object):
|
||||
|
||||
|
||||
class PyField(PyXrefMixin, Field):
|
||||
pass
|
||||
def make_xref(self, rolename, domain, target,
|
||||
innernode=nodes.emphasis, contnode=None, env=None):
|
||||
# type: (unicode, unicode, unicode, nodes.Node, nodes.Node, BuildEnvironment) -> nodes.Node # NOQA
|
||||
if rolename == 'class' and target == 'None':
|
||||
# None is not a type, so use obj role instead.
|
||||
rolename = 'obj'
|
||||
|
||||
return super(PyField, self).make_xref(rolename, domain, target,
|
||||
innernode, contnode, env)
|
||||
|
||||
|
||||
class PyGroupedField(PyXrefMixin, GroupedField):
|
||||
|
Loading…
Reference in New Issue
Block a user