{"action":"opened","issue":{"url":"https://api.github.com/repos/noripyt/django-cachalot/issues/115","repository_url":"https://api.github.com/repos/noripyt/django-cachalot","labels_url":"https://api.github.com/repos/noripyt/django-cachalot/issues/115/labels{/name}","comments_url":"https://api.github.com/repos/noripyt/django-cachalot/issues/115/comments","events_url":"https://api.github.com/repos/noripyt/django-cachalot/issues/115/events","html_url":"https://github.com/noripyt/django-cachalot/issues/115","id":359178528,"node_id":"MDU6SXNzdWUzNTkxNzg1Mjg=","number":115,"title":"Can't pickle memoryview objects","user":{"login":"mheppner","id":2390428,"node_id":"MDQ6VXNlcjIzOTA0Mjg=","avatar_url":"https://avatars3.githubusercontent.com/u/2390428?v=4","gravatar_id":"","url":"https://api.github.com/users/mheppner","html_url":"https://github.com/mheppner","followers_url":"https://api.github.com/users/mheppner/followers","following_url":"https://api.github.com/users/mheppner/following{/other_user}","gists_url":"https://api.github.com/users/mheppner/gists{/gist_id}","starred_url":"https://api.github.com/users/mheppner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mheppner/subscriptions","organizations_url":"https://api.github.com/users/mheppner/orgs","repos_url":"https://api.github.com/users/mheppner/repos","events_url":"https://api.github.com/users/mheppner/events{/privacy}","received_events_url":"https://api.github.com/users/mheppner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-11T19:00:02Z","updated_at":"2018-09-11T19:00:02Z","closed_at":null,"author_association":"NONE","body":"I'm getting this error after updating from 1.50 to 2.1.0:\r\n\r\n```python\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py\", line 35, in inner\r\n    response = get_response(request)\r\n  File \"/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py\", line 128, in _get_response\r\n    response = self.process_exception_by_middleware(e, request)\r\n  File \"/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py\", line 126, in _get_response\r\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n  File \"/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py\", line 54, in wrapped_view\r\n    return view_func(*args, **kwargs)\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/viewsets.py\", line 95, in view\r\n    return self.dispatch(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/views.py\", line 494, in dispatch\r\n    response = self.handle_exception(exc)\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/views.py\", line 454, in handle_exception\r\n    self.raise_uncaught_exception(exc)\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/views.py\", line 491, in dispatch\r\n    response = handler(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/mixins.py\", line 48, in list\r\n    return Response(serializer.data)\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py\", line 742, in data\r\n    ret = super(ListSerializer, self).data\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py\", line 262, in data\r\n    self._data = self.to_representation(self.instance)\r\n  File \"/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py\", line 660, in to_representation\r\n    self.child.to_representation(item) for item in iterable\r\n  File \"/usr/local/lib/python3.6/site-packages/django/db/models/query.py\", line 272, in __iter__\r\n    self._fetch_all()\r\n  File \"/usr/local/lib/python3.6/site-packages/django/db/models/query.py\", line 1179, in _fetch_all\r\n    self._result_cache = list(self._iterable_class(self))\r\n  File \"/usr/local/lib/python3.6/site-packages/django/db/models/query.py\", line 53, in __iter__\r\n    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)\r\n  File \"/usr/local/lib/python3.6/site-packages/cachalot/monkey_patch.py\", line 32, in inner\r\n    return original(compiler, *args, **kwargs)\r\n  File \"/usr/local/lib/python3.6/site-packages/cachalot/monkey_patch.py\", line 86, in inner\r\n    cache_key, table_cache_keys)\r\n  File \"/usr/local/lib/python3.6/site-packages/cachalot/monkey_patch.py\", line 62, in _get_result_or_execute_query\r\n    cache.set_many(to_be_set, cachalot_settings.CACHALOT_TIMEOUT)\r\n  File \"/usr/local/lib/python3.6/site-packages/django/core/cache/backends/base.py\", line 216, in set_many\r\n    self.set(key, value, timeout=timeout, version=version)\r\n  File \"/usr/local/lib/python3.6/site-packages/django/core/cache/backends/filebased.py\", line 50, in set\r\n    f.write(zlib.compress(pickle.dumps(value, pickle.HIGHEST_PROTOCOL)))\r\nTypeError: can't pickle memoryview objects\r\n```\r\n\r\n- Python 3.6.5\r\n- Django 2.0.3\r\n- django-cachalot 2.1.0\r\n- djangorestframework 3.7.7\r\n- Postgres 9.6, PostGIS 2.4.4\r\n\r\nThe model it's getting this error on has a `django.contrib.postgres.fields.JSONField`. I know the docs mention the bug about using the file-based backend with Postgres range fields (which is now closed), but is this related? Are all Postgres fields unsupported?\r\n\r\nMy model also has a `django.contrib.gis.db.models.PolygonField`. I'm pretty sure we were using this field type, and the JSON field, without issues with django-cachalot 1.5."}}
{"actor":{"display_login":"mheppner"}}