[Python-Dev] Re: Jython bugs or features?

Samuele Pedroni pedronis@bluewin.ch
Mon, 25 Feb 2002 21:18:36 +0100

 [Dinu Gherman]
> 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?

Given how things concretely are and not considering
some abstract point of view, I would say YMMV.

I have skimmed over CPython 2.1 std lib,
honestly there are not many places relevant to Jython where list for
copying lists is used and where the bug can show through.
Consider things like:

a += list(b) OR b = ... + list(b)

and all the places where l = list(sq) and sq is not a list,
those works in Jython.

Btw here simply Jython was never up to speed
(that means always implemented the wrong semantics)
and nobody noticed this or to be precise ever
reported this.

OTOH we try to be responsive to bug reports.

Yes the test suites are *far* from optimal
and CPython sometimes regresses too.

> My impression is that Jython claims to be an implementation of
> Python in Java.

Yes but your PS (see below) shows that this can mean
a lot of things, Jython is more about writing new programs
and Java integration (which is a big and non-easy part and of its
codebase) than for example supporting completely CPython os
and shell-like programming and allowing effortless porting of
all kinds of CPython programs (clearly list bug is another kind of issue
given that the right behaviour is well documented).

Java integration has a higher priority than those thing.
Jython is more about embracing  the Java platform
(philosophy) than work-arounding it.
For example anything that would require writing
JNI glue and native C code is simply discarded.

There are things for which CPython is simply
better suited than Java/Jython and the other way

They are not fully equivalent substitutes.

> Everybody understands the existence 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.
> Honestly, I don't think it makes much sense to maintain two
> code bases without some degree of automatic testing...

JPython is not born with such a test, and Jython until
now has never grown one. But I have taken note of this
adding a feature request for such a test but is more a matter of resources
and priorities than easiness.

Btw after some checking of the CPython CVS


(look at the change in the module-level __doc__ )

it seems that reset is vestigial and one should use seek(0)

reset is not supported by StringIO or by files
and not documented (not after 1.5 for sure).

You made me think that it was added in 2.1,
so at least IMO it is an option for Jython to have decided
not to support it.

> 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.

See e.g.:
and thread.

> 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: ..

We don't support this one, sorry.