Skip to content

Partially revert #1326 #1406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions astroid/interpreter/_import/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,5 @@ def is_namespace(modname: str) -> bool:
if not isinstance(spec.loader, abc.InspectLoader):
return True

# Lastly we check if the package declares itself a namespace package
try:
source = spec.loader.get_source(spec.origin)
# If the loader can't handle the spec, we're dealing with a namespace package
except ImportError:
return False
return bool(
source and "pkg_resources" in source and "declare_namespace(__name__)" in source
)
# TODO: We should find a way to check this without importing pkg_resources
return _is_old_setuptools_namespace_package(modname)