diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2022-05-31 04:32:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 10:32:00 +0200 |
commit | 1ccb1c455b71bcf453253d996e3739f5153f2774 (patch) | |
tree | a132b4ec908d80a95cabcd81bdea31b40d1d214d /astroid/interpreter | |
parent | 2ff48000b6896e17ffe7ca04722cf6a61b7a27cb (diff) | |
download | astroid-git-1ccb1c455b71bcf453253d996e3739f5153f2774.tar.gz |
Special case `__main__` in `is_namespace()` (#1579)
Diffstat (limited to 'astroid/interpreter')
-rw-r--r-- | astroid/interpreter/_import/util.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/astroid/interpreter/_import/util.py b/astroid/interpreter/_import/util.py index 3de921b8..5db1702d 100644 --- a/astroid/interpreter/_import/util.py +++ b/astroid/interpreter/_import/util.py @@ -34,8 +34,8 @@ def is_namespace(modname: str) -> bool: working_modname, path=last_submodule_search_locations ) except ValueError: - # executed .pth files may not have __spec__ - return True + # Assume it's a .pth file, unless it's __main__ + return modname != "__main__" except KeyError: # Intermediate steps might raise KeyErrors # https://github.com/python/cpython/issues/93334 |