Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#6745 task closed duplicate (duplicate)

support for Jython 2.7

Reported by: tkanerva Owned by:
Priority: normal Milestone:
Component: core Keywords: jython
Cc: Arfrever.FTA@… Branch:
Author: tkanerva Launchpad Bug:

Description (last modified by exarkun)

Twisted should support running under Jython 2.7 (currently 2.7b1).

Currently there are a small number of differences to CPython, e.g. missing buffer, thread.ident, others.

Included patches for these files:
twisted/python/compat.py
twisted/python/threadable.py
twisted/internet/abstract.py

Included patches will fix enough issues to get a simple Resource loaded and a Site running:

>>> from klein import Klein
>>> from twisted.web.server import Site
>>> from twisted.internet import reactor
>>> class Foo(object):
...  app = Klein()
...  @app.route('/')
...  def idx(self, request):
...   return "<h1>works</h1>"
... 
>>> new=Foo()
>>> r=new.app.resource()
>>> factory=Site(r)
>>> reactor.listenTCP(9998,factory)
<<class 'twisted.internet.tcp.Port'> of twisted.web.server.Site on 9998>
>>> reactor.run()

Attachments (3)

jython-1.patch (1.0 KB) - added by tkanerva 13 months ago.
compat.py now differentiates between Jython and CPython and chooses a Jython-compatible lazyByteSlice for Jython.
jython-2.patch (836 bytes) - added by tkanerva 13 months ago.
twisted.internet.abstract: added a check for Jython that will avoid using buffer() which does not exist - sharing the codepath with PY3.
jython-3.patch (608 bytes) - added by tkanerva 13 months ago.
threadable.getThreadID(): now works on Jython as well

Download all attachments as: .zip

Change History (6)

Changed 13 months ago by tkanerva

compat.py now differentiates between Jython and CPython and chooses a Jython-compatible lazyByteSlice for Jython.

Changed 13 months ago by tkanerva

twisted.internet.abstract: added a check for Jython that will avoid using buffer() which does not exist - sharing the codepath with PY3.

Changed 13 months ago by tkanerva

threadable.getThreadID(): now works on Jython as well

comment:1 Changed 13 months ago by Arfrever

  • Cc Arfrever.FTA@… added

comment:2 Changed 13 months ago by exarkun

  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for your interest in this. Please see #3413 where work on support for Jython has already begun. I think you should file new tickets for specific issues (perhaps one for each patch you have here) and link to them from #3413.

comment:3 Changed 13 months ago by exarkun

  • Description modified (diff)
Note: See TracTickets for help on using tickets.