Finish Jython compatibility #541

Open
wants to merge 4 commits into
from

Projects

None yet

2 participants

@alekstorm
Contributor

I cherry-picked Ben's excellent start on Jython support from his personal fork and finished up the rest.

Notes that aren't covered in commit messages:

  • Jython 2.5.2's socket.inet_pton() incorrectly reports domain names like 'www.google.com' as valid IP addresses. There isn't really a way around this short of parsing IP addresses ourselves, and it's fixed in 2.5.3b1 anyway.
  • The IP address returned from socket.accept() is unicode, not str. I have no idea why, and I've filed a report here. The pull request includes a workaround.
  • The Jython 2.7 alphas would probably be working, if not for a glaring bug that I've filed here.
  • Since all the tests pass except the (minor) one mentioned above, I took the liberty of explicitly listing support for CPython, PyPy, and Jython in the README. If anyone objects, this can easily be reverted.
bdarnell and others added some commits May 12, 2012
@bdarnell @alekstorm bdarnell Get most of the tests running on jython
Remaining failures:
* XHeaderTest.test_ip_headers: jython doesn't have AI_NUMERICHOST
* TestIOLoop.test_add_callback_wakeup: Timing-sensitive, jython is slow
* TestIOStream.test_connection_refused: I'm not sure how to detect errors
  on an async connect, since jython doesn't support SO_ERROR
* TestIOStream.test_streaming_until_close: Needs more investigation.
* SimpleHTTPClientTestCase.test_gzip:  jython's zlib module doesn't support
  gzip-headers

Conflicts:

	tornado/httpserver.py
	tox.ini
2ec2495
@alekstorm alekstorm More Jython compatibility fixes
* IOStream.read_until_close() now reads from buffer before listening on the
  socket (probably affected CPython too, but didn't trip any tests)
* Replace socket.getaddrinfo() with socket.inet_pton() to validate IP addresses
  in httpserver, move to module-level function from HTTPServer method
* Relaxed time-sensitive IOLoop test
* Convert IP address returned from socket.accept() to str from unicode
822a039
@alekstorm alekstorm Support gzip decompression in Jython
* Move current GzipDecompressor from util to platform.common, use on Windows
  and POSIX
* Create Jython-compatible GzipCompressor in new platform.java module
* Tweak tests to be more accommodating to Jython's zlib implementation
f93ebda
@alekstorm alekstorm Cover supported interpreters in README 8103ff4
@bdarnell bdarnell added the multiple label Jul 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment