diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-02-27 14:43:55 -0500 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-03-02 14:08:42 -0500 |
| commit | 1b22d53bf67943cd193bbd6e327d955c19d2f5d2 (patch) | |
| tree | 74b0eb2f02a0642d40426e2f841e80746219e43d /django/utils | |
| parent | 27ed90a8a829aa25f2ff3dc121f8429c2b06f662 (diff) | |
[6.0.x] Fixed #36961 -- Fixed TypeError in deprecation warnings if Django is imported by namespace.
Backport of c1d8646ec219b8b90ebdd463f40e5767876658a0 from main.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/deprecation.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py index eea24cf94b..11a37f05bc 100644 --- a/django/utils/deprecation.py +++ b/django/utils/deprecation.py @@ -12,9 +12,8 @@ from django.utils.inspect import signature @functools.cache def django_file_prefixes(): - try: - file = django.__file__ - except AttributeError: + file = getattr(django, "__file__", None) + if file is None: return () return (os.path.dirname(file),) |
