#32450: "TypeError: cannot pickle" when applying | operator to a Q object
-------------------------------------+-------------------------------------
Reporter: Daniel | Owner: nobody
Izquierdo |
Type: Bug | Status: new
Component: Database | Version: 3.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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 doing using `.keys()` should work.
I can work on a patch if there's agreement that this should not crash.
--
Ticket URL: <https://code.djangoproject.com/ticket/32450>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.5c49d724ec79a77285d1d1016aebc5f5%40djangoproject.com.