mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-17 01:15:02 +08:00
Merge pull request #483 from ColinDuquesnoy/fix_runtime_error
Fix RuntimeError: the PyQt5.QtCore and PyQt4.QtCore modules both wrap the QObject class
This commit is contained in:
@@ -322,7 +322,14 @@ def load_module(path, name):
|
||||
sys_path.insert(0, p)
|
||||
|
||||
temp, sys.path = sys.path, sys_path
|
||||
__import__(dotted_path)
|
||||
try:
|
||||
__import__(dotted_path)
|
||||
except RuntimeError:
|
||||
if 'PySide' in dotted_path or 'PyQt' in dotted_path:
|
||||
# RuntimeError: the PyQt4.QtCore and PyQt5.QtCore modules both wrap
|
||||
# the QObject class.
|
||||
# See https://github.com/davidhalter/jedi/pull/483
|
||||
return None
|
||||
# Just access the cache after import, because of #59 as well as the very
|
||||
# complicated import structure of Python.
|
||||
module = sys.modules[dotted_path]
|
||||
|
||||
@@ -190,6 +190,9 @@ class ImportWrapper(pr.Base):
|
||||
analysis.add(self._evaluator, 'import-error', e.name_part)
|
||||
return []
|
||||
|
||||
if module is None:
|
||||
return []
|
||||
|
||||
if self.import_stmt.is_nested() and not self.nested_resolve:
|
||||
scopes = [NestedImportModule(module, self.import_stmt)]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user