#24381: Cache pickling exception in 1.8a1 with cross-table filter params
-------------------------------------+-------------------------------------
     Reporter:  marktranchant        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  1.8alpha1
     Severity:  Release blocker      |               Resolution:
     Keywords:  cache pickle empty   |             Triage Stage:
  queryset                           |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by marktranchant:

Old description:

> In 1.7.4, I can run the following transcript in ../manage.py shell. The
> Contributor model has two ForeignKeys, to MyModel and Task, so I'm
> looking up all MyModels which have a referring contributor associated
> with task 4.
>
> {{{
> >>> from MyProject.models import *
> >>> from django.core.cache import cache
> >>> cl = MyModel.objects.filter(contributor__task__id=4)
> >>> cl
> <<< []
> >>> type(cl)
> <<< django.db.models.query.QuerySet
> >>> cache.set('testing', cl)
> >>> cache.get('testing')
> <<< []
> }}}
>
> In 1.8a1, the cache set operation generates an exception. See attachment
> for trace.
>
> {{{
> PicklingError: Can't pickle <type 'module'>: it's not found as
> __builtin__.module
> }}}
>
> If I try to cache a simple empty QuerySet (MyModel.objecrts.filter(id=0),
> for example), it works.

New description:

 In 1.7.4 (and prior versions back to at least 2011), I can run the
 following transcript in ../manage.py shell. The Contributor model has two
 ForeignKeys, to MyModel and Task, so I'm looking up all MyModels which
 have a referring contributor associated with task 4.

 {{{
 >>> from MyProject.models import *
 >>> from django.core.cache import cache
 >>> cl = MyModel.objects.filter(contributor__task__id=4)
 >>> cl
 <<< []
 >>> type(cl)
 <<< django.db.models.query.QuerySet
 >>> cache.set('testing', cl)
 >>> cache.get('testing')
 <<< []
 }}}

 In 1.8a1, the cache set operation generates an exception. See attachment
 for trace.

 {{{
 PicklingError: Can't pickle <type 'module'>: it's not found as
 __builtin__.module
 }}}

 If I try to cache a simple empty QuerySet (MyModel.objects.filter(id=0),
 for example), it works.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24381#comment:4>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.e884df17ed260ff31d7fdb5b8361df9f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to