Skip to content

Commit

Permalink
Simplify namespace package detection on Python 3.7+ (#1566)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed May 15, 2022
1 parent 95bbd5e commit 3ff65be
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions astroid/interpreter/_import/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,7 @@ class PathSpecFinder(Finder):
def find_module(self, modname, module_parts, processed, submodule_path):
spec = importlib.machinery.PathFinder.find_spec(modname, path=submodule_path)
if spec:
# origin can be either a string on older Python versions
# or None in case it is a namespace package:
# https://github.com/python/cpython/pull/5481
is_namespace_pkg = spec.origin in {"namespace", None}
is_namespace_pkg = spec.origin is None
location = spec.origin if not is_namespace_pkg else None
module_type = ModuleType.PY_NAMESPACE if is_namespace_pkg else None
spec = ModuleSpec(
Expand Down

0 comments on commit 3ff65be

Please sign in to comment.