mirror of
https://github.com/davidhalter/jedi.git
synced 2026-10-18 17:51:27 +08:00
Fix py__path__ availability in #2118
This commit is contained in:
1 parent
79d9764bce
commit
102700116c
1 file changed
+11
-3
@@ -416,10 +416,18 @@ def import_module(inference_state, import_names, parent_module_value, sys_path):
|
|||||||
if is_pkg is None:
|
if is_pkg is None:
|
||||||
return NO_VALUES
|
return NO_VALUES
|
||||||
else:
|
else:
|
||||||
paths = parent_module_value.py__path__()
|
try:
|
||||||
if paths is None:
|
py__path__ = parent_module_value.py__path__
|
||||||
# The module might not be a package.
|
except AttributeError:
|
||||||
|
# Due to meta_path, the value can be pretty much any compiled value
|
||||||
|
# and we're not guaranteed that the attribute is available, see
|
||||||
|
# also https://github.com/davidhalter/jedi/issues/2118
|
||||||
return NO_VALUES
|
return NO_VALUES
|
||||||
|
else:
|
||||||
|
paths = py__path__()
|
||||||
|
if paths is None:
|
||||||
|
# The module might not be a package.
|
||||||
|
return NO_VALUES
|
||||||
|
|
||||||
file_io_or_ns, is_pkg = inference_state.compiled_subprocess.get_module_info(
|
file_io_or_ns, is_pkg = inference_state.compiled_subprocess.get_module_info(
|
||||||
string=import_names[-1],
|
string=import_names[-1],
|
||||||
|
|||||||
Reference in new issue
Block a user