On Thu, Apr 30, 2015 at 11:18 AM, Robbie Gemmell <robbie.gemm...@gmail.com>
wrote:

> On 30 April 2015 at 15:56, Ken Giusti <kgiu...@redhat.com> wrote:
> >
> >
> > ----- Original Message -----
> >> From: "Robbie Gemmell" <robbie.gemm...@gmail.com>
> >> To: proton@qpid.apache.org
> >> Cc: us...@qpid.apache.org
> >> Sent: Thursday, April 30, 2015 10:20:07 AM
> >> Subject: Re: Python 3 port is 'done'
> >>
> >> On 29 April 2015 at 21:05, Ken Giusti <kgiu...@redhat.com> wrote:
> >> >
> >> > Well, done enough to consider merging to master.
> >> >
> >> > While the patch is quite large, most of the changes are simple syntax
> >> > changes to avoid non-python3 compliant syntax.
> >> >
> >> > The code is available on the kgiusti-python3 branch at the Apache
> repo.
> >> >
> >> >
> https://git-wip-us.apache.org/repos/asf?p=qpid-proton.git;a=shortlog;h=refs/heads/kgiusti-python3
> >> >
> >> > I've also made a patch that can be viewed up on reviewboard:
> >> >
> >> > https://reviews.apache.org/r/33691/
> >> >
> >> > I've verified that the unit tests and python examples run under
> python2.6,
> >> > 2.7, and python3.3.   I'd appreciate if folks would take this patch
> for a
> >> > spin and report back their experience.
> >> >
> >> > Known Issues:
> >> >
> >> > These changes will be incompatible with earlier versions of the
> python 2.x
> >> > series.  I know for a fact that python versions <= 2.4 won't even
> parse
> >> > this patch, and I suspect getting such older versions of python to
> work
> >> > would require lots of effort.   I'm a little unsure of how well
> python 2.5
> >> > will be supported - I have yet to test that far back.  I also didn't
> test
> >> > anything earlier than 3.3 in the python3.x stream.
> >> >
> >> > --
> >> > -K
> >>
> >> I gave thigns a kick with Python 2.7, and Jython 2.5.3 without issue.
> >>
> >> I also tried the maven build with Jython 2.7 RC3 (there was a new one)
> >> and things exploded similarly to the way they did before.
> >>
> >
> > Thanks Robbie.
> >
> > What kind of issues does Jython 2.7 complain about?  I'll have to
> install that RC at some point... :(
> >
> > -K
>
> Lots of the tests fail due to error, most if not all of which seem to
> be "TypeError: Type not compatible with array". As I say though, this
> isnt to do with your changes since it did that last time I tried too
> :)
>

I happened to run into a similar error recently and tracked the issue down.
I believe this error is due to an API incompatibility between jython 2.5
and jython 2.7. In jython 2.5 you need to convert python strings into java
byte arrays manually and you use the 'array' constructor from the jarray
module to do this, e.g. something like:
array("string-that-has-bytes-in-it", 'b') will construct a java byte array
from a python string. In jython 2.7 this conversion is done automatically
(which is nice). Sadly though, the array constructor that worked in jython
2.5 now barfs with exactly the TypeError message you are showing above. I
was able to get a simple smoke test working with proton-j and jython 2.7 by
removing the array constructor and just passing the string directly,
however this will not work on 2.5, so we probably either need to write our
own conversion function that behaves differently for different jython
versions or do a full switch over to 2.7.

--Rafael

Reply via email to