#35554: Model.save() positional argument parsing slightly incorrect
-------------------------------------+-------------------------------------
Reporter: Adam | Owner: Adam Johnson
Johnson |
Type: Bug | Status: assigned
Component: Database | Version: 5.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Ticket #35060 introduced a deprecation pathway for positional arguments in
`Model.save()`. The code introduced to match positional arguments is
slightly incorrect, leading to some subtle behaviour changes:
1. Calling with extra positional arguments, such as `Model.save(False,
False, None, None, None)`, no longer raises a `TypeError`.
2. Calling with positional empty `update_fields`, such as
`Model.save(False, False, None, [])`, would try to save all fields, due to
truthy-checking of arguments.
These are definitely edge cases, but we can easily avoid them with
alternative parsing logic. PR incoming.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35554>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.