From cecdec91cf08fa8ad70a22d2a03bec3e86692350 Mon Sep 17 00:00:00 2001 From: William Schwartz Date: Fri, 26 Mar 2021 10:14:07 +0100 Subject: [PATCH] Refs #32355 -- Corrected comments about Python's _NamespacePath. _NamespacePath supports indexing in Python 3.8+. --- django/apps/config.py | 3 +-- django/utils/module_loading.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/django/apps/config.py b/django/apps/config.py index bced53d506b..7dfb4b4e159 100644 --- a/django/apps/config.py +++ b/django/apps/config.py @@ -73,8 +73,7 @@ class AppConfig: """Attempt to determine app's filesystem path from its module.""" # See #21874 for extended discussion of the behavior of this method in # various cases. - # Convert paths to list because Python's _NamespacePath doesn't support - # indexing. + # Convert to list because __path__ may not support indexing. paths = list(getattr(module, '__path__', [])) if len(paths) != 1: filename = getattr(module, '__file__', None) diff --git a/django/utils/module_loading.py b/django/utils/module_loading.py index 9f58c068562..8c798f69bbd 100644 --- a/django/utils/module_loading.py +++ b/django/utils/module_loading.py @@ -85,7 +85,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. + # Convert to list because __path__ may not support indexing. paths = list(getattr(module, '__path__', [])) if len(paths) == 1: return paths[0]