From: <pj...@us...> - 2008-07-31 23:16:40
|
Revision: 5034 http://jython.svn.sourceforge.net/jython/?rev=5034&view=rev Author: pjenvey Date: 2008-07-31 23:16:37 +0000 (Thu, 31 Jul 2008) Log Message: ----------- move __index__ out of the generated code section Modified Paths: -------------- branches/asm/src/org/python/core/PyInstance.java Modified: branches/asm/src/org/python/core/PyInstance.java =================================================================== --- branches/asm/src/org/python/core/PyInstance.java 2008-07-31 22:07:13 UTC (rev 5033) +++ branches/asm/src/org/python/core/PyInstance.java 2008-07-31 23:16:37 UTC (rev 5034) @@ -759,7 +759,28 @@ return ((PyTuple)ret).getArray(); } + /** + * Implements the __index__ method by looking it up + * in the instance's dictionary and calling it if it is found. + **/ + public PyObject __index__() { + PyObject ret; + try { + ret = invoke("__index__"); + } catch (PyException pye) { + if (!Py.matchException(pye, Py.AttributeError)) { + throw pye; + } + throw Py.TypeError("object cannot be interpreted as an index"); + } + if (ret instanceof PyInteger || ret instanceof PyLong) { + return ret; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)", + ret.getType().fastGetName())); + } + // Generated by make_binops.py // Unary ops @@ -862,27 +883,6 @@ return invoke("__invert__"); } - /** - * Implements the __index__ method by looking it up - * in the instance's dictionary and calling it if it is found. - **/ - public PyObject __index__() { - PyObject ret; - try { - ret = invoke("__index__"); - } catch (PyException pye) { - if (!Py.matchException(pye, Py.AttributeError)) { - throw pye; - } - throw Py.TypeError("object cannot be interpreted as an index"); - } - if (ret instanceof PyInteger || ret instanceof PyLong) { - return ret; - } - throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)", - ret.getType().fastGetName())); - } - // Binary ops /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |