Message10689

Author jsaiz
Recipients babelmania, jsaiz, zyasoft
Date 2016-02-02.09:42:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454406179.81.0.695148419683.issue2456@psf.upfronthosting.co.za>
In-reply-to
Content
Patching JavaProxyList.listRemoveOverrideProxy like this works for us:

private static final PyBuiltinMethodNarrow listRemoveOverrideProxy = new ListMethod("remove", 1) {
    @Override
    public PyObject __call__(PyObject object) {
        List jlist = asList();
        for (int i = 0; i < jlist.size(); i++) {
            Object jobj = jlist.get(i);
            if (Py.java2py(jobj)._eq(object).__nonzero__()) {
                jlist.remove(i);
                return Py.None;
            }
        }
        // START PATCH FOR BUG 2456
        if (object instanceof PyInteger) {
            jlist.remove(((PyInteger)object).getValue());
            return Py.None;
        }
        // END PATCH FOR BUG 2456
        throw Py.ValueError(object.toString() + " is not in list");
    }
};

It would be nice if such a change is incorporated in the library, as we consider this as another regression in Jython 2.7.0 with respect to Jython 2.5.2.
History
Date User Action Args
2016-02-02 09:42:59jsaizsetmessageid: <1454406179.81.0.695148419683.issue2456@psf.upfronthosting.co.za>
2016-02-02 09:42:59jsaizsetrecipients: + jsaiz, zyasoft, babelmania
2016-02-02 09:42:59jsaizlinkissue2456 messages
2016-02-02 09:42:59jsaizcreate