1
0
mirror of https://github.com/django/django.git synced 2025-03-09 17:02:43 +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
e83a88566a71a2353cebc35992c110be0f8628af because signals no longer use
sync_to_async().
This commit is contained in:
Mariusz Felisiak 2023-11-19 16:29:13 +01:00 committed by GitHub
parent acf4cee951
commit b5750b9f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ from django.utils import timezone
from django.utils.formats import FORMAT_SETTINGS, reset_format_cache
from django.utils.functional import empty
from django.utils.module_loading import import_string
from django.utils.version import PY312
template_rendered = Signal()
@ -183,7 +184,7 @@ def complex_setting_changed(*, enter, setting, **kwargs):
# this stacklevel shows the line containing the override_settings call.
warnings.warn(
f"Overriding setting {setting} can lead to unexpected behavior.",
stacklevel=6,
stacklevel=5 if PY312 else 6,
)