[Twisted-web] [(maybe) BACKWARDS INCOMPATIBLE] Moving Twisted to PEP-3333

Amber "Hawkie" Brown hawkowl at atleastfornow.net
Tue Dec 22 07:29:12 MST 2015


> On 22 Dec 2015, at 14:27, Amber Hawkie Brown <hawkowl at atleastfornow.net> wrote:
> 
> Hi everyone!
> 
> We've been attempting to port twisted.web.wsgi to Python 3, as of recent. The existence of PEP-3333 makes this easier, but due to our backwards compatibility policy, implementing stricter checks to make sure t.w.wsgi-using applications are actually PEP-3333 may be a change which cannot be easily done.
> 
> The patch we have currently, which is based on work by jMyles (of Hendrix), tirelessly worked on allennap (of Canonical MAAS), and sheparded along by the wonderful Adi (our other Twisted Fellow), is in very good shape, bringing Twisted's WSGI support to be compliant with PEP-3333. PEP-3333 is much stricter on bytes/Unicode, and the patch introduces some further type checking that the original PEP-333 describes as a must, even though we did not check this before.
> 
> This branch cannot currently be merged because of backwards compatibility issues -- the spirit of our Compatibility Policy is that 'apps keep working', and sufficiently Unicode unclean WSGI applications may break due to it, even though PEP-333 is very explicit in saying that "HTTP does not directly support Unicode, and neither does this interface".
> 
> So, I am looking to get a compat exception for this -- WSGI is very explicit in its types, and any misbehaving applications are violating the specification grossly enough for there to possibly not need a compat exception -- but going through this way may catch the attention of anyone with a potentially misbehaving application and fix it before Twisted 16.0, when I expect this will be merged.
> 
> The ticket is https://twistedmatrix.com/trac/ticket/7993, and the branch you should test against is linked at the top. The compatibility policy will allow a week before we move to merge the ticket, although we may have some changes to the branch to make warnings turn into errors, if we are breaking backwards compat, so please ensure no exceptions *or warnings* are produced by your code.
> 
> Thanks,
> 
> - Amber
> Twisted Fellow, RM, Python 3 Overlord
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Hi everyone!

So, with further looking with Tom Prince, it appears that my backwards compat fears in regards to Unicode were from my older remembering of the branch, allenap and Adi have made it so that it raises a warning on Python 2 if you're not Unicode/bytes clean, as well as introducing hard-checks on Python 3, where it is reasonable to do so.

So, this should mean that all your Python 2 WSGI apps should keep working, even if they're not Unicode clean, but I am still wanting to go through the exception process to give users of Twisted's WSGI support a chance to raise any problems that they may have with the PEP-3333-compatible code, as unlikely as they are to be.

I'd like to say thanks again to allenap and Adi's herculean efforts on this branch :)

- Amber

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://twistedmatrix.com/pipermail/twisted-web/attachments/20151222/a4784479/attachment.pgp>


More information about the Twisted-web mailing list