Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#35561 closed Bug (fixed)

Model.save()/asave() deprecation allows duplicate arguments

Reported by: Adam Johnson Owned by: Natalia Bidart
Component: Database layer (models, ORM) Version: 5.1
Severity: Release blocker Keywords:
Cc: Adam Johnson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Follow-up to #35554.

The deprecation code from #35060 allows duplicate arguments between the positional and keyword variants. For example, Model.save(True, force_insert=False) tries to set force_insert to True positionally and False by keyword.

This should be detected and raised as a TypeError, like Python would normally do.

Change History (6)

comment:1 by Natalia Bidart, 5 months ago

Has patch: set
Owner: changed from nobody to Natalia Bidart
Severity: NormalRelease blocker
Status: newassigned
Triage Stage: UnreviewedAccepted
Type: Cleanup/optimizationBug

comment:2 by Natalia Bidart, 5 months ago

Cc: Adam Johnson added

comment:3 by Natalia Bidart, 5 months ago

Triage Stage: AcceptedReady for checkin

comment:4 by Natalia <124304+nessita@…>, 5 months ago

Resolution: fixed
Status: assignedclosed

In 432b069b:

[5.1.x] Fixed #35561 -- Made *args and kwargs parsing more strict in Model.save()/asave().

Backport of e56a32b89bb7fadffdfaa2cdf12b4863ccd5af9b from main.

comment:5 by Natalia Bidart, 5 months ago

comment:6 by GitHub <noreply@…>, 5 months ago

In a5215f9a:

Refs #35561 -- Renamed Model.save()/asave() helper to a more specific name.

Note: See TracTickets for help on using tickets.
Back to Top