Cast memoryview objects to bytes to be able to pickle them. (#163)

Fixes #125
This commit is contained in:
Denick 2020-09-09 22:12:11 +02:00 committed by GitHub
parent 689f679ad3
commit d24e3b37ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
import copyreg
from django import __version__ as django__version__, VERSION as django_version
from django.apps import AppConfig
from django.conf import settings
@ -93,4 +94,7 @@ class CachalotConfig(AppConfig):
name = 'cachalot'
def ready(self):
# Cast memoryview objects to bytes to be able to pickle them.
# https://docs.python.org/3/library/copyreg.html#copyreg.pickle
copyreg.pickle(memoryview, lambda val: (memoryview, (bytes(val),)))
cachalot_settings.load()