Opened 7 years ago
Closed 7 years ago
#29330 closed Bug (fixed)
Regression in master: cannot pickle queryset with expression
Reported by: | Daniel Miller | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Removal of BaseExpression.__getstate__
in PR 9134 caused querysets with expressions derived from BaseExpression
to no longer be pickle-able.
Error:
Traceback (most recent call last): File "/home/travis/build/millerdev/django-cte/tests/test_recursive.py", line 212, in test_pickle_recursive_cte_queryset pickled_qs = pickle.loads(pickle.dumps(regions)) AttributeError: Can't pickle local object 'BaseExpression.convert_value.<locals>.<lambda>'
Seen here: https://travis-ci.org/millerdev/django-cte/jobs/366128465
Steps to reproduce:
- Clone django-cte
- Make a virtualenv any way you prefer.
pip install git+https://github.com/django/django.git@master
(or however you prefer to install django master).pip install nose
nosetests tests.test_recursive:TestRecursiveCTE.test_pickle_recursive_cte_queryset
- Observe pickle error.
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/9878