Fix #3597: python domain raises UnboundLocalError if invalid name given

This commit is contained in:
Takeshi KOMIYA 2017-04-02 22:55:40 +09:00
parent 98e8fa992e
commit 57019c291a
2 changed files with 3 additions and 2 deletions

View File

@ -13,6 +13,8 @@ Features added
Bugs fixed
----------
* #3597: python domain raises UnboundLocalError if invalid name given
Testing
--------

View File

@ -302,6 +302,7 @@ class PyObject(ObjectDescription):
only the most recent object is tracked. This object prefix name will be
removed with :py:meth:`after_content`.
"""
prefix = None
if self.names:
# fullname and name_prefix come from the `handle_signature` method.
# fullname represents the full object name that is constructed using
@ -312,8 +313,6 @@ class PyObject(ObjectDescription):
prefix = fullname
elif name_prefix:
prefix = name_prefix.strip('.')
else:
prefix = None
if prefix:
self.env.ref_context['py:class'] = prefix
if self.allow_nesting: