[issue4718] wsgiref package totally broken

Antoine Pitrou report at bugs.python.org
Tue Dec 23 15:26:52 CET 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

> No, just as PEP said str used as a container for binary data.

This is clearly the wrong thing to do. The only (immutable) string-like
object adequate for binary data in py3k is bytes, not str.

I understand the desire to stick to the PEP, but the PEP was devised
even before the first py3k alphas, and it clearly wasn't written with
py3k in mind. For example the following sentence becomes nonsensical:

        Again, all strings referred to in this specification must be of
        type str or StringType, and must not be of type unicode or
        UnicodeType.

since "str" objects *are* of type UnicodeType in py3k (and the C API is
still named PyUnicode_*)...

When a legal text becomes nonsensical wrt. reality, one has to adapt his
interpretation of the text to reality, not adapt reality to match the
nonsense.

In other words, wsgiref should accept/expose HTTP bodies as bytes, not
str. Confusing binary data with iso-8859-1 text is the kind of mess py3k
was designed to avoid.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4718>
_______________________________________


More information about the Python-bugs-list mailing list