[Django] #36716: Debugging can get stuck in an infinite loop if a setting is contained in itself

3 views
Skip to first unread message

Django

unread,
Nov 7, 2025, 6:17:31 AM (4 days ago) Nov 7
to django-...@googlegroups.com
#36716: Debugging can get stuck in an infinite loop if a setting is contained in
itself
-------------------------------------+-------------------------------------
Reporter: Willem Van Onsem | Type:
| Uncategorized
Status: new | Component: Core
| (Other)
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Django can get stuck in an infinite loop when cleansing settings.

Indeed, imagine we have a setting:

{{{
MY_SETTING = []
MY_SETTING.append(MY_SETTING)
}}}

If we now visit a page that raises an error, and Django starts the
debugging process, it will get stuck in infinite recursion.

while it might look a bit odd that settings can contain themself, it
renders the server unresponsive when an error happens and we run it in
debug.

We can for cleansing add a list of visited `id(..)`s of the settings, and
if visited a second time, block the rendering.
--
Ticket URL: <https://code.djangoproject.com/ticket/36716>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 7, 2025, 8:08:57 AM (4 days ago) Nov 7
to django-...@googlegroups.com
#36716: Debugging can get stuck in an infinite loop if a setting is contained in
itself
-------------------------------------+-------------------------------------
Reporter: Willem Van Onsem | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Core (Other) | Version: 5.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* resolution: => wontfix
* status: new => closed
* type: Uncategorized => Cleanup/optimization

Comment:

Hello Willem, thank you for taking the time to report this. I understand
the situation you are describing. However, this kind of infinite recursion
can occur in many parts of Python when language features are used in
unintended ways. Since this only affects the local development environment
(since debug is on, which is not intended for production use), I think the
impact is limited and can be resolved locally during development. It does
not seem worth adding extra complexity or overhead to Django’s settings
handling to guard against such rare misuse cases.
--
Ticket URL: <https://code.djangoproject.com/ticket/36716#comment:1>
Reply all
Reply to author
Forward
0 new messages