#36759: Fixed variable shadowing in ValidationError.__init__()
-------------------------------------+-------------------------------------
Reporter: Mohit Sharma | Type: Bug
Status: new | Component: Core
| (Other)
Version: dev | Severity: Normal
Keywords: variable-shadowing | Triage Stage:
ValidationError exceptions | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
== Problem ==
The `ValidationError.__init__()` method has a variable shadowing bug in
the list processing branch. The loop variable `message` shadows the
function parameter `message`, which can cause issues when processing lists
of validation errors.
== Location ==
`django/core/exceptions.py`, line 175
== Current Code ==
for message in message: # Variable shadowing!== Solution ==
Rename the loop variable from `message` to `item` to avoid shadowing the
function parameter.
== Patch ==
I have a patch ready with:
- Fix: Renamed loop variable to `item`
- Test: Added comprehensive test `test_list_input_processes_all_items()`
- All existing tests pass
== Branch ==
Branch: ticket_12345
PR: [Will add PR link after creating]
== Solution ==
Rename the loop variable from message to item to avoid shadowing the
function parameter.
== Patch ==
I have a patch ready with:
Fix: Renamed loop variable to item
Test: Added comprehensive test test_list_input_processes_all_items()
All existing tests pass
== Branch ==
Branch: ticket_12345
PR: [Will add PR link after creating]
--
Ticket URL: <
https://code.djangoproject.com/ticket/36759>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.