mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5172 from tk0miya/4946_None_for_rtype_field
Fix py domain: rtype field could not handle "None" as a type (refs: #4946)
This commit is contained in:
commit
a86e5098ed
1
CHANGES
1
CHANGES
@ -43,6 +43,7 @@ Bugs fixed
|
||||
* #5143: autodoc: crashed on inspecting dict like object which does not support
|
||||
sorting
|
||||
* #5139: autodoc: Enum argument missing if it shares value with another
|
||||
* #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