Message5760

Author babelmania
Recipients babelmania
Date 2010-05-06.07:59:35
SpamBayes Score 0.00181205
Marked as misclassified No
Message-id <1273132776.81.0.828416781275.issue1605@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following Java class:
------------
public class Bar {
    public PyObject __call__(float x) {
        return dump(x);
    }
    
    public PyObject __call__(double x) {
        return dump(x);
    }
    
    public PyObject __call__(PyComplex x) {
        return dump(x);
    }
    
    private PyObject dump(Object o) {
        System.out.println("called with "+o.getClass()+"="+o);
        return Py.None;
    }
}
------------

calling this demo class in Jython as follows:
$ foo=Bar();
$ foo(2.);
called with class java.lang.Double=2.0
$ foo(1+2j);
TypeError: can't convert complex to float; use e.g. abs(z)
------------

This worked in Jython 2.1 and it seems that Jython 2.5.1 is broken in this respect.
History
Date User Action Args
2010-05-06 07:59:36babelmaniasetrecipients: + babelmania
2010-05-06 07:59:36babelmaniasetmessageid: <1273132776.81.0.828416781275.issue1605@psf.upfronthosting.co.za>
2010-05-06 07:59:36babelmanialinkissue1605 messages
2010-05-06 07:59:35babelmaniacreate