Fix #4946: py domain: type field could not handle "None" as a type

This commit is contained in:
Takeshi KOMIYA 2018-05-19 22:50:10 +09:00
parent bd6442bf96
commit 9ccff74f66
2 changed files with 10 additions and 1 deletions

View File

@ -32,6 +32,7 @@ Bugs fixed
LaTeX engine crashed
* #4978: latex: shorthandoff is not set up for Brazil locale
* #4928: i18n: Ignore dot-directories like .git/ in LC_MESSAGES/
* #4946: py domain: type field could not handle "None" as a type
Testing
--------

View File

@ -156,7 +156,15 @@ class PyGroupedField(PyXrefMixin, GroupedField):
class PyTypedField(PyXrefMixin, TypedField):
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(PyTypedField, self).make_xref(rolename, domain, target,
innernode, contnode, env)
class PyObject(ObjectDescription):