#23664: bool evaluation on an OrderedSet gives different results in Py2 and Py3 ----------------------------+--------------------------------- Reporter: tchaumeny | Owner: nobody Type: Bug | Status: new Component: Utilities | Version: master Severity: Normal | Keywords: Python3, OrderedSet Triage Stage: Unreviewed | Has patch: 1 Easy pickings: 0 | UI/UX: 0 ----------------------------+--------------------------------- `bool(OrderedSet())` evaluates to `False` in Python 2, `True` in Python 3 because `__bool__` is not defined (but `__nonzero__` is).
I searched the codebase for similar cases and found that it was the same with `QuerySet`, though this does not have consequences as `QuerySet.__len__` is defined and `bool` will use that in Py3. The PR addresses both classes for consistency. -- Ticket URL: <https://code.djangoproject.com/ticket/23664> 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/052.c9e6d4b35c0b6ef53860e4a531ce0ed4%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.