Jython bugs or features?

Ype Kingma ykingma at accessforall.nl
Mon Feb 25 14:33:12 EST 2002


Dinu,

Dinu Gherman wrote:
> 
> In article <3c7a70d2_4 at news.bluewin.ch>,
>  "Samuele Pedroni" <pedronis at bluewin.ch> wrote:
> 
> > Yes they are bugs. Please report them.
> > Since 2.1 release (two month ago) there have been approximately  10000
> > download.
> >
> > How are such bugs possible?
> >
> > 1. the typical idiom for list(l) is l[:] (mildly irrelevant I know)
> > 2. if you check the test suite for CPython 2.1 and Jython there is no test
> > for list(l) behavior
> > 3. the new reset method is also not tested by the test suite and is not
> > reported in the NEWS file
> >
> > (These are the result of some grepping, maybe I'm wrong but given the bugs
> > probably I'm right).
> >
> > We try to follow the big picture and the PEPs and check the NEWS file but
> > for the rest the test suites
> > are our best hope vs. delusional friend.
> > If a feature is old, under-used, or through usage the bug does not show
> > through, and un-tested things become tricky.
> >
> > It is open source: Jython is as conforming as its community and CPython
> > community ACTIVELY want it to be.
> 
> I'm pretty surprised! I knew the Python test suite is *very* far
> from complete, but list() is an *extremely* crucial function,
> isn't it?

Samuele already gave the workaround for list() on a list, (ie. [:])
so it's not very extremely crucial.

> My impression is that Jython claims to be an implementation of
> Python in Java. Everybody understands the existance of bugs, but
> if functions are missing I'm not sure there is sufficient quality
> control, leave alone a useful test suite. My bold guess is that
> it should be very easy to check automatically for each module in
> the std.lib. at least if the same classes and methods do exist
> in CPython and JPython.

That requires dumping the std lib interface in CPython and checking
this dump against the Jython standard libs. It could be straightforward
but I don't see how.

> Honestly, I don't think it makes much sense to maintain two
> code bases without some degree of automatic testing...

There are test suites for Jython but they cannot be completely 
the same as for CPython, eg. because the implementations
differ in support for the python language, ie. jython is normally
a bit behind.
It's almost straightforward to run the CPython test suite in
Jython when you have both of them installed. I did this when I
started in jython just over a year ago to see how wel it Jython
conforms to CPython.
At that time most of the difference was in unicode support.
You might try the same now, I guess you'll be pleasantly surprised.

> 
> When seeing such bugs, my immediate reaction (like that of most
> others) is to think that not many people can be using this serious-
> ly.

Well, for every bug solved in jython the developers add a test case
these days. The bug reports at jython.sourceforge.net will give
you an impression of what kinds of things people run into nowadays
when they use Jython. I thought I'd refer you to bugs link at
www.jython.org, but you've been there already. Thanks.

> Regards,
> 
> Dinu
> 
> PS: BTW, how about this one:
> 
> [localhost:~] dinu% jython
> Jython 2.1 on java1.3.1 (JIT: null)
> Type "copyright", "credits" or "license" for more information.
> >>> import os
> >>> os.chdir('..')
> Traceback (innermost last):
>   File "<console>", line 1, in ?
>   File ".../Jython-2.1/Lib/javaos.py", line 56, in chdir
> OSError: [Errno 0] chdir not supported in Java: ..

Since Jython is based on Java there is no way to directly
support chdir.
There has been some work going on on the jython's
os module lately, but this may not be in the latest release.
I don't know whether a workaround was made for chdir.
Ask on jython-dev if you want to know more...

Have fun,
Ype

P.S. Although jython used to be known for finding bugs in JIT
compilers, I can recommend to use a JIT if you have one...



More information about the Python-list mailing list