mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[4.2.x] Refs #34118 -- Fixed stacklevel in complex_setting_changed on Python 3.12.
This fix is unnecessary in Django 5.0 since
e83a88566a because signals no longer use
sync_to_async().
This commit is contained in:
@@ -14,6 +14,7 @@ from django.utils import timezone
|
|||||||
from django.utils.formats import FORMAT_SETTINGS, reset_format_cache
|
from django.utils.formats import FORMAT_SETTINGS, reset_format_cache
|
||||||
from django.utils.functional import empty
|
from django.utils.functional import empty
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
|
from django.utils.version import PY312
|
||||||
|
|
||||||
template_rendered = Signal()
|
template_rendered = Signal()
|
||||||
|
|
||||||
@@ -183,7 +184,7 @@ def complex_setting_changed(*, enter, setting, **kwargs):
|
|||||||
# this stacklevel shows the line containing the override_settings call.
|
# this stacklevel shows the line containing the override_settings call.
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
f"Overriding setting {setting} can lead to unexpected behavior.",
|
f"Overriding setting {setting} can lead to unexpected behavior.",
|
||||||
stacklevel=6,
|
stacklevel=5 if PY312 else 6,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user