summaryrefslogtreecommitdiff
path: root/django/conf/__init__.py
diff options
context:
space:
mode:
authorTheo Alexiou <theofilosalexiou@gmail.com>2022-02-13 17:27:12 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-16 10:51:15 +0100
commit97d7990abde3fe4b525ae83958fd0b52d6a1d13f (patch)
tree56e0ba7eae9e551bcccfbd87995a8020836ab228 /django/conf/__init__.py
parent1d071ec1aa8fa414bb96b41f7be8a1bd01079815 (diff)
Fixed #28358 -- Prevented LazyObject from mimicking nonexistent attributes.
Thanks Sergey Fedoseev for the initial patch.
Diffstat (limited to 'django/conf/__init__.py')
-rw-r--r--django/conf/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index e1fb7f973f..55bf15a355 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -157,8 +157,9 @@ class LazySettings(LazyObject):
def USE_L10N(self):
stack = traceback.extract_stack()
# Show a warning if the setting is used outside of Django.
- # Stack index: -1 this line, -2 the caller.
- filename, _, _, _ = stack[-2]
+ # Stack index: -1 this line, -2 the LazyObject __getattribute__(),
+ # -3 the caller.
+ filename, _, _, _ = stack[-3]
if not filename.startswith(os.path.dirname(django.__file__)):
warnings.warn(
USE_L10N_DEPRECATED_MSG,