#31418: ValueError when FileBasedCache is used in Python 3.7
-------------------------------------+-------------------------------------
     Reporter:  mastizada            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Cache system)  |                  Version:  2.2
     Severity:  Release blocker      |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 Python 3.8 introduced [https://www.python.org/dev/peps/pep-0574/ pickle
 protocol 5] and pointed `pickle.HIGHEST_PROTOCOL` at it. You most likely
 ran your project on Python 3.8 and stored things in a cache using the
 `FileBasedCache` backend and then tried running your project on Python
 3.7.

 If you're in process of migrating from 3.7 to 3.8 you'll likely want to
 subclass `FileBasedCache` and set its `pickle_protocol` to `4` and use it
 as your backend during the transition period. When you've fully migrated
 to Python 3.8 you can swap back to `FileBasedCache`.

 I had to do similar manipulations when moving projects from Python 2 to 3
 which makes me wonder if we should add a `CACHE_PICKLE_PROTOCOL` setting
 or allow to specify it via `CACHES['OPTIONS']` to avoid having to
 subclassing backends when such a transition is required. This is likely to
 be more of an issue as more and more people migrate to 3.8.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31418#comment:6>
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/067.06f74c336b3f098f086a9f19beb5dac2%40djangoproject.com.

Reply via email to