summaryrefslogtreecommitdiff
path: root/django/utils/module_loading.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils/module_loading.py')
-rw-r--r--django/utils/module_loading.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/django/utils/module_loading.py b/django/utils/module_loading.py
index 38119431fa..df8e65098d 100644
--- a/django/utils/module_loading.py
+++ b/django/utils/module_loading.py
@@ -72,11 +72,10 @@ def module_has_submodule(package, module_name):
full_module_name = package_name + '.' + module_name
try:
return importlib_find(full_module_name, package_path) is not None
- except (ImportError, AttributeError):
- # When module_name is an invalid dotted path, Python raises ImportError
- # (or ModuleNotFoundError in Python 3.6+). AttributeError may be raised
+ except (ModuleNotFoundError, AttributeError):
+ # When module_name is an invalid dotted path, Python raises
+ # ModuleNotFoundError. AttributeError is raised on PY36 (fixed in PY37)
# if the penultimate part of the path is not a package.
- # (https://bugs.python.org/issue30436)
return False
@@ -87,7 +86,7 @@ def module_dir(module):
Raise ValueError otherwise, e.g. for namespace packages that are split
over several directories.
"""
- # Convert to list because _NamespacePath does not support indexing on 3.3.
+ # Convert to list because _NamespacePath does not support indexing.
paths = list(getattr(module, '__path__', []))
if len(paths) == 1:
return paths[0]