Fixed #29166 -- Fixed crash in When() expression with a list argument.

Thanks Matthew Pava for the report and Tim Graham and Carlton Gibson for
reviews.
Regression in 19b2dfd1bf.
This commit is contained in:
Mariusz Felisiak 2018-02-28 18:05:23 +01:00 committed by GitHub
parent 3fb718f17d
commit 54f80430be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View file

@ -369,7 +369,12 @@ class BaseExpression:
def __hash__(self):
path, args, kwargs = self.deconstruct()
return hash((path,) + args + tuple(kwargs.items()))
kwargs = kwargs.copy()
output_field = type(kwargs.pop('output_field', None))
return hash((path, output_field) + args + tuple([
(key, tuple(value)) if isinstance(value, list) else (key, value)
for key, value in kwargs.items()
]))
class Expression(BaseExpression, Combinable):