Opened 11 years ago
Closed 11 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 |
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 by , 11 years ago
Has patch: | set |
---|
comment:2 by , 11 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #21643. Will add comments there about back porting the fix to 1.6.
Pull request opened.
https://github.com/django/django/pull/2330