Merge pull request #4993 from tk0miya/4946_pydomain_None_type

Fix #4946: py domain: type field could not handle "None" as a type
This commit is contained in:
Takeshi KOMIYA 2018-05-20 15:09:11 +09:00 committed by GitHub
commit 679002c483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

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

View File

@ -156,7 +156,15 @@ class PyGroupedField(PyXrefMixin, GroupedField):
class PyTypedField(PyXrefMixin, TypedField): 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): class PyObject(ObjectDescription):