1
0
forked from VimPlug/jedi

Catch some cases were _sqlite3.Connection was misidentified as sqlite3.Connection

This commit is contained in:
Dave Halter
2019-12-15 16:15:45 +01:00
parent 8fc84a2aaa
commit 35442eff81
2 changed files with 31 additions and 0 deletions

View File

@@ -386,6 +386,21 @@ class DirectObjectAccess(object):
if inspect.ismodule(return_obj):
return [access]
try:
module = return_obj.__module__
except AttributeError:
pass
else:
try:
__import__(module)
# For some modules like _sqlite3, the __module__ for classes is
# different, in this case it's sqlite3. So we have to try to
# load that "original" module, because it's not loaded yet. If
# we don't do that, we don't really have a "parent" module and
# we would fall back to builtins.
except ImportError:
pass
module = inspect.getmodule(return_obj)
if module is None:
module = inspect.getmodule(type(return_obj))