Opened 10 years ago

Closed 10 years ago

#22101 closed Bug (duplicate)

Querysets using F() expressions with time deltas are not cloned correctly.

Reported by: Tai Lee Owned by: nobody
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords: queryset timedelta expression regression
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


This appears to be a regression in 1.6. Possibly refs #16759.

Looks like expression nodes are no longer deep copied, so when a query that uses DateModifierNode is cloned, the second clone to be evaluated will generate an exception when the DateModifierNode tries to pop the timedelta off node.children.

Suspected fix is to persist the timedelta as an attribute on DateModifierNode expression in __init__ so we don't need to pop it off node.children when the node is evaluated.

Change History (2)

comment:1 Changed 10 years ago by Tai Lee

Has patch: set

comment:2 Changed 10 years ago by Tai Lee

Resolution: duplicate
Status: newclosed

Duplicate of #21643. Will add comments there about back porting the fix to 1.6.

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