[Python-Dev] WSGI is now Python 3-friendly

P.J. Eby pje at telecommunity.com
Sun Sep 26 03:45:13 CEST 2010

At 09:22 PM 9/25/2010 -0400, Jesse Noller wrote:
>It seems like it will end up
>different enough to be a different specification, closely related to
>the original, but different enough to trip up all the people
>maintaining current WSGI servers and apps.

The only actual *change* to the spec is mandating the use of the 
'bytes' type or equivalent for HTTP bodies when using Python 3.

Seriously, that's *it*.

Everything else that's (planned to be) added is either 100% truly 
just clarifications (e.g. nothing in the spec *ever* said SERVER_PORT 
could be an int, but apparently some people somehow interpreted it 
so), or else best-practice recommendations from people who actually 
implemented WSGI servers.

For example, the readline() size hint is "not supported" in the 
original spec (meaning clients can't call it and be compliant).  The 
planned modification is "servers should implement it" (best 
practice), but you can't call an implementation that *doesn't* 
implement it noncompliant.  (This just addresses the fact that most 
practical implementations *did* in fact support it, and code out 
there relies on this.)

So, no (previously-)compliant implementations were harmed in the 
making of the updated spec.  If they were compliant before, they're 
compliant now.

I'm actually a bit surprised people are bringing this up now, since 
when I announced the plan to make these changes, I said that nothing 
would be changed that would break anything...  even for what I 
believe are the only Python 3 WSGI implementations right now (by 
Graham Dumpleton and Robert Brewer).

Indeed, all of the changes (except the bytes thing) are stuff 
previously discussed endlessly on the Web-SIG (years ago in most 
cases) and widely agreed on as, "this should have been made clear in 
the original PEP".

And, I also explicitly deferred and/or rejected items that *can't* be 
done in a 100% backward-compatible way, and would have to be WSGI 1.1 
or higher -- indeed, I have a long list of changes from Graham that 
I've pronounced "can't be done without a 1.1".

Indeed, the entire point of the my scope choices were to allow all 
this to happen *without* a whole new spec.  ;-)

More information about the Python-Dev mailing list