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:
Takeshi KOMIYA 2018-07-15 22:22:31 +09:00 committed by GitHub
commit a86e5098ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -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
--------

View File

@ -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):