#19616: QuerySet.__contains__ tries to check the length of a None -------------------------------------+------------------------------------- Reporter: kalugny@… | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 1.4 (models, ORM) | Resolution: Severity: Normal | Triage Stage: Keywords: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by anonymous): Replying to [comment:1 Alex]: > Can you actually reproduce this in any way? Calling `iter(self)` should cause `_result_cache` to start being a list. Yes, I noticed this because it happened to me. The reproduction is a bit complex, though. I used this snippet: http://djangosnippets.org/snippets/1034/ And it happened when trying to iterate an empty QuerySet. I naturally thought that this is a bug with me or the snippet, but looking at the code it is pretty obvious that although the function expects that _result_cache might be None it still tries to len() it. -- Ticket URL: <https://code.djangoproject.com/ticket/19616#comment:2> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.