#24045: Useless calls to mark_safe and mark_for_escaping
------------------------------------------------+------------------------
               Reporter:  aaugustin             |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Core (Other)          |        Version:  master
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 Currently Django contains code similar to:

 {{{
     if isinstance(message, SafeData):
         return mark_safe(message)
 }}}

 Since `mark_safe` is a no-op on `SafeData` instances, that's  useless!

 We should check when that code was introduced, if `mark_safe` was always a
 no-op on `SafeData`, and if that reveals a bug or simply useless code.

 In the former case we should fix the bug, in the latter remove the code.

 There are similar cases with `mark_for_escaping` which is a no-op both on
 `SafeData` and `EscapeData` instances.

--
Ticket URL: <https://code.djangoproject.com/ticket/24045>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.24916187fae01c2f39c7fcf023d1e01e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to