diff options
Diffstat (limited to 'django/utils/module_loading.py')
| -rw-r--r-- | django/utils/module_loading.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/utils/module_loading.py b/django/utils/module_loading.py index df8e65098d..9f58c06856 100644 --- a/django/utils/module_loading.py +++ b/django/utils/module_loading.py @@ -72,10 +72,9 @@ 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 (ModuleNotFoundError, AttributeError): + except ModuleNotFoundError: # 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. + # ModuleNotFoundError. return False |
