﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29330	Regression in master: cannot pickle queryset with expression	Daniel Miller	nobody	"Removal of `BaseExpression.__getstate__` in [https://github.com/django/django/pull/9134#pullrequestreview-112057277 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 [https://github.com/dimagi/django-cte 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."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed			Ready for checkin	0	0	0	0	0	0
