#21198: @python_2_unicode_compatible, abstract models, working on 1.4 but causing infinite loop on 1.5. ---------------------------+------------------------------------ Reporter: jpic | Owner: nobody Type: Bug | Status: new Component: Utilities | Version: 1.5 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ---------------------------+------------------------------------ Changes (by aaugustin):
* needs_better_patch: => 0 * component: Uncategorized => Utilities * needs_tests: => 0 * needs_docs: => 0 * type: Uncategorized => Bug * stage: Unreviewed => Accepted Comment: The documentation makes it clear that `@python_2_unicode_compatible` is only intended for classes that have a `__str__` method. https://docs.djangoproject.com/en/dev/ref/utils/#django.utils.encoding.python_2_unicode_compatible Django's historical behavior of building `__str__` from `__unicode__` and backwards-compatibility concerns make `@python_2_unicode_compatible` prone to infinite recursion. This is extremely hard to debug. It's impossible to print the object since `unicode`, `str` and `repr` all go into infinite recursion. I'd like to raise a better exception instead. -- Ticket URL: <https://code.djangoproject.com/ticket/21198#comment:1> 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/062.8d0ec2c6c01316c079263c7bdc55e86b%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.