#22101 closed Bug (duplicate)

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

Reported by: mrmachine 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

Description

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 12 months ago by mrmachine

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 12 months ago by mrmachine

  • Resolution set to duplicate
  • Status changed from new to closed

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