1
0
forked from VimPlug/jedi

fix an issue with missing '__class__' methods e.g. in numpy

This commit is contained in:
Dave Halter
2014-01-13 02:30:10 +01:00
parent c602dc1c40
commit a96a2baf5b
2 changed files with 8 additions and 2 deletions

View File

@@ -237,7 +237,7 @@ class BaseDefinition(object):
""" """
try: try:
return self._definition.doc return self._definition.doc or '' # Always a String, never None.
except AttributeError: except AttributeError:
return self.raw_doc return self.raw_doc

View File

@@ -56,7 +56,13 @@ class PyObject(Base):
def _cls(self): def _cls(self):
# Ensures that a PyObject is returned that is not an instance (like list) # Ensures that a PyObject is returned that is not an instance (like list)
if fake.is_class_instance(self.obj): if fake.is_class_instance(self.obj):
return PyObject(self.obj.__class__, self.parent) try:
c = self.obj.__class__
except AttributeError:
# happens with numpy.core.umath._UFUNC_API (you get it
# automatically by doing `import numpy`.
c = type(None)
return PyObject(c, self.parent)
return self return self
def get_defined_names(self): def get_defined_names(self):