#32450 closed Bug (fixed)
"TypeError: cannot pickle" when applying | operator to a Q object
Reported by: | Daniel Izquierdo | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.1 |
Severity: | Normal | Keywords: | |
Cc: | Tom Forbes | 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 (last modified by )
Using a reference to a non-pickleable type of object such as dict_keys
in a Q
object makes the |
operator fail:
>>> from django.db.models import Q >>> Q(x__in={}.keys()) <Q: (AND: ('x__in', dict_keys([])))> >>> Q() | Q(x__in={}.keys()) Traceback (most recent call last): ... TypeError: cannot pickle 'dict_keys' object
Even though this particular example could be solved by doing Q() | Q(x__in={})
it still feels like using .keys()
should work.
I can work on a patch if there's agreement that this should not crash.
Change History (5)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 4 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
Thanks for this report.
Regression in bb0b6e526340e638522e093765e534df4e4393d2.