#25501: Filebased cache should use the highest pickling protocol
-------------------------------------+--------------------
Reporter: BertrandBordage | Owner: nobody
Type: Bug | Status: new
Component: Core (Cache system) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+--------------------
I came across this bug when caching `psycopg2._range.NumericRange` objects
in [https://github.com/BertrandBordage/django-cachalot django-cachalot]
(in order to add Django 1.8 support to it). [https://travis-
ci.org/BertrandBordage/django-cachalot/builds/83412824 My test suite was
failing] only on Python 2 and with filebased (and of course, Django 1.8,
because `django.contrib.postgres` didn’t exist before). This error was
thrown:
{{{
TypeError: a class that defines __slots__ without defining __getstate__
cannot be pickled
}}}
This is because, unlike
[https://github.com/django/django/blob/0ed7d155635da9f79d4dd67e4889087d3673c6da/django/core/cache/backends/locmem.py#L75
locmem] or
[https://github.com/django/django/blob/e2a652fac1ce9af51e2dfdfb4e26a1c94cf3189c/django/core/cache/backends/db.py#L114
db],
[https://github.com/django/django/blob/0ed7d155635da9f79d4dd67e4889087d3673c6da/django/core/cache/backends/filebased.py#L58
filebased uses the default pickling protocol] and not the highest
available. Since we are not trying to achieve read compatibility with old
Python versions, we can use the highest protocol here as well.
This issue occur on master, Django 1.7.10, 1.8.4, & 1.9 alpha 1.
--
Ticket URL: <https://code.djangoproject.com/ticket/25501>
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/058.dd3144ebce06565c49dd9d6fa84eb93e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.