#29643: Hashing list in Q objects when using __in lookup
-------------------------------------+-------------------------------------
     Reporter:  rhyre                |                    Owner:  felixxm
         Type:  Bug                  |                   Status:  assigned
    Component:  Utilities            |                  Version:  2.0
     Severity:  Release blocker      |               Resolution:
     Keywords:  hash, tuple, list,   |             Triage Stage:  Accepted
  drf                                |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by rhyre):

 Full traceback:
 {{{
 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/core/handlers/exception.py" in inner
   35.             response = get_response(request)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/core/handlers/base.py" in _get_response
   128.                 response = self.process_exception_by_middleware(e,
 request)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/core/handlers/base.py" in _get_response
   126.                 response = wrapped_callback(request,
 *callback_args, **callback_kwargs)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/views/decorators/csrf.py" in wrapped_view
   54.         return view_func(*args, **kwargs)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/rest_framework/viewsets.py" in view
   95.             return self.dispatch(request, *args, **kwargs)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/rest_framework/views.py" in dispatch
   494.             response = self.handle_exception(exc)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/rest_framework/views.py" in handle_exception
   454.             self.raise_uncaught_exception(exc)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/rest_framework/views.py" in dispatch
   491.             response = handler(request, *args, **kwargs)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/rest_framework/mixins.py" in list
   40.         queryset = self.filter_queryset(self.get_queryset())

 File "/home/rhyre/-/testline_rest.py" in get_queryset
   109.         return LegacyTestlineService.list_testlines()

 File "/home/rhyre/-/testline.py" in list_testlines
   162.         return cache_query(key='testline/list', func=query,
 args=['id', 'name', 'status', 'add_date'], timeout=600)

 File "/home/rhyre/-/cache.py" in cache_query
   40.         cache.set(key, dill.dumps(result), timeout)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/dill/_dill.py" in dumps
   293.     dump(obj, file, protocol, byref, fmode, recurse)#, strictio)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/dill/_dill.py" in dump
   286.         pik.dump(obj)

 File "/usr/lib64/python3.6/pickle.py" in dump
   409.         self.save(obj)

 File "/usr/lib64/python3.6/pickle.py" in save
   496.                 rv = reduce(self.proto)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/query.py" in __getstate__
   224.         self._fetch_all()

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/query.py" in _fetch_all
   1179.             self._result_cache = list(self._iterable_class(self))

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/query.py" in __iter__
   53.         results =
 compiler.execute_sql(chunked_fetch=self.chunked_fetch,
 chunk_size=self.chunk_size)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/sql/compiler.py" in execute_sql
   1055.             sql, params = self.as_sql()

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/sql/compiler.py" in as_sql
   448.             extra_select, order_by, group_by = self.pre_sql_setup()

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/sql/compiler.py" in pre_sql_setup
   55.         group_by = self.get_group_by(self.select + extra_select,
 order_by)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/sql/compiler.py" in get_group_by
   129.         expressions = self.collapse_group_by(expressions,
 having_group_by)

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/sql/compiler.py" in collapse_group_by
   180.                 expr for expr in expressions if expr in pks or
 getattr(expr, 'alias', None) not in aliases

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/sql/compiler.py" in <listcomp>
   180.                 expr for expr in expressions if expr in pks or
 getattr(expr, 'alias', None) not in aliases

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/expressions.py" in __hash__
   390.             for key, value in kwargs.items()

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/db/models/expressions.py" in __hash__
   390.             for key, value in kwargs.items()

 File "/home/rhyre/.virtualenvs/py3new/lib/python3.6/site-
 packages/django/utils/tree.py" in __hash__
   74.         return hash((self.__class__, self.connector, self.negated) +
 tuple(self.children))

 Exception Type: TypeError at /testline/list/ajax
 Exception Value: unhashable type: 'list'
 Request information:
 USER: AnonymousUser
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29643#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.4a0e4a343ba6de0faed2cdfe20859c0e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to