#28121: force_text incorrectly handles SafeBytes under PY3
------------------------------------+--------------------------------------
Reporter: Thomas Achtemichuk | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Comment (by Thomas Achtemichuk):
It could be argued that this satisfies both: "Functionality bug in newly-
introduced features" (the feature being PY3 support), and "Regressions
from older versions of Django." Since the 1.0 release a decade ago, when
variable auto-escaping was added, `force_text` and `force_unicode` before
it have always passed "safe" bytestrings through as "safe" unicode
strings. I guess the question is, according to the "rule of thumb" in the
supported versions policy:
Had this been discovered in the lead-up to the 1.6 release (PY3 support),
would the different behavior between PY2 and PY3 been a release blocker?
I'd assume that the goal of all that hard work was to have Django function
the identically under PY2 and PY3, and any difference in behavior would
have been a blocker. As someone who is doing the a bunch of that same hard
work right now in my own codebase, that change in behavior causing a unit
test (and entire app) to fail is definitely a blocker for me.
The other consideration would be: "Would changing this behavior under PY3
//now// break anything in existing codebases?"
To which my answer would be: If one has code that relies on auto-escaping
a bytestring //explicitly// passed through `mark_safe`, and only under
PY3... That's not the type of code worth supporting instead of fixing
inconsistent behavior between python versions.
--
Ticket URL: <https://code.djangoproject.com/ticket/28121#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 [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/065.ef6644830bb47793544166c6febd256c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.