mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #25501 -- Made the file-based cache backend use the highest pickling protocol.
This commit is contained in:
committed by
Tim Graham
parent
9e3f6c7483
commit
48888a1a67
9
tests/cache/tests.py
vendored
9
tests/cache/tests.py
vendored
@@ -65,6 +65,11 @@ class Unpickable(object):
|
||||
raise pickle.PickleError()
|
||||
|
||||
|
||||
class UnpicklableType(object):
|
||||
# Unpicklable using the default pickling protocol on Python 2.
|
||||
__slots__ = 'a',
|
||||
|
||||
|
||||
@override_settings(CACHES={
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
|
||||
@@ -1221,6 +1226,10 @@ class FileBasedCacheTests(BaseCacheTests, TestCase):
|
||||
cache.set('foo', 'bar')
|
||||
os.path.exists(self.dirname)
|
||||
|
||||
def test_cache_write_unpickable_type(self):
|
||||
# This fails if not using the highest pickling protocol on Python 2.
|
||||
cache.set('unpickable', UnpicklableType())
|
||||
|
||||
|
||||
@override_settings(CACHES={
|
||||
'default': {
|
||||
|
||||
Reference in New Issue
Block a user