On Apr 5, 2008, at 1:16 AM, JLIST wrote:
> I'm trying to run a CPython package chardet on Jython.
> But I'm getting errors like this:
> java.lang.ClassFormatError: java.lang.ClassFormatError: Invalid method
> Code length 69890 in class file chardet/euckrfreq$py
> Could this limitation be removed? The package runs fine on CPython.
It's not that easy, unfortunately this is a limitation of the JVM.
Methods can't be larger than 64K bytes.
There's a bug logged for a similar situation for large Strings:
Could you log a separate issue for this problem?
We can definitely solve the String situation by detecting when a
String is too large and automatically breaking it apart at the Java
bytecode level. Breaking apart a method on the other hand sounds much
more complicated (think of all the things your IDE actually does when
you ask it to refactor a method).
The easiest way to get around this is to manually break apart the
offending Python method on your own, and maybe submit a patch back to
the chardet project.
> BTW, jython does not seem to support site-packages? It doesn't
> exist under Lib directory.
The 2.2 releases do not (there's no distutils either), but trunk does.