From: <pj...@us...> - 2008-07-28 06:40:14
|
Revision: 5008 http://jython.svn.sourceforge.net/jython/?rev=5008&view=rev Author: pjenvey Date: 2008-07-28 06:40:09 +0000 (Mon, 28 Jul 2008) Log Message: ----------- deriveds changes for __index__ Modified Paths: -------------- branches/asm/src/org/python/core/PyArrayDerived.java branches/asm/src/org/python/core/PyBaseExceptionDerived.java branches/asm/src/org/python/core/PyBooleanDerived.java branches/asm/src/org/python/core/PyClassMethodDerived.java branches/asm/src/org/python/core/PyComplexDerived.java branches/asm/src/org/python/core/PyDictionaryDerived.java branches/asm/src/org/python/core/PyEnumerateDerived.java branches/asm/src/org/python/core/PyFileDerived.java branches/asm/src/org/python/core/PyFloatDerived.java branches/asm/src/org/python/core/PyFrozenSetDerived.java branches/asm/src/org/python/core/PyIntegerDerived.java branches/asm/src/org/python/core/PyListDerived.java branches/asm/src/org/python/core/PyLongDerived.java branches/asm/src/org/python/core/PyModuleDerived.java branches/asm/src/org/python/core/PyObjectDerived.java branches/asm/src/org/python/core/PyPropertyDerived.java branches/asm/src/org/python/core/PySetDerived.java branches/asm/src/org/python/core/PySliceDerived.java branches/asm/src/org/python/core/PyStringDerived.java branches/asm/src/org/python/core/PySuperDerived.java branches/asm/src/org/python/core/PyTupleDerived.java branches/asm/src/org/python/core/PyTypeDerived.java branches/asm/src/org/python/core/PyUnicodeDerived.java branches/asm/src/org/python/modules/_weakref/ReferenceTypeDerived.java branches/asm/src/org/python/modules/collections/PyDefaultDictDerived.java branches/asm/src/org/python/modules/collections/PyDequeDerived.java branches/asm/src/org/python/modules/random/PyRandomDerived.java branches/asm/src/org/python/modules/thread/PyLocalDerived.java branches/asm/src/org/python/modules/zipimport/zipimporterDerived.java Modified: branches/asm/src/org/python/core/PyArrayDerived.java =================================================================== --- branches/asm/src/org/python/core/PyArrayDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyArrayDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyBaseExceptionDerived.java =================================================================== --- branches/asm/src/org/python/core/PyBaseExceptionDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyBaseExceptionDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -830,6 +830,20 @@ return super.__finditem__(key); } + public PyObject __finditem__(int key) { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__getitem__"); + if (impl!=null) + try { + return impl.__get__(this,self_type).__call__(new PyInteger(key)); + } catch (PyException exc) { + if (Py.matchException(exc,Py.LookupError)) + return null; + throw exc; + } + return super.__finditem__(key); + } + public PyObject __getitem__(PyObject key) { // Same as __finditem__, without swallowing LookupErrors. This allows // __getitem__ implementations written in Python to raise custom @@ -867,29 +881,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1029,6 +1057,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyBooleanDerived.java =================================================================== --- branches/asm/src/org/python/core/PyBooleanDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyBooleanDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyClassMethodDerived.java =================================================================== --- branches/asm/src/org/python/core/PyClassMethodDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyClassMethodDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyComplexDerived.java =================================================================== --- branches/asm/src/org/python/core/PyComplexDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyComplexDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyDictionaryDerived.java =================================================================== --- branches/asm/src/org/python/core/PyDictionaryDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyDictionaryDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyEnumerateDerived.java =================================================================== --- branches/asm/src/org/python/core/PyEnumerateDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyEnumerateDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyFileDerived.java =================================================================== --- branches/asm/src/org/python/core/PyFileDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyFileDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyFloatDerived.java =================================================================== --- branches/asm/src/org/python/core/PyFloatDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyFloatDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyFrozenSetDerived.java =================================================================== --- branches/asm/src/org/python/core/PyFrozenSetDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyFrozenSetDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyIntegerDerived.java =================================================================== --- branches/asm/src/org/python/core/PyIntegerDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyIntegerDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyListDerived.java =================================================================== --- branches/asm/src/org/python/core/PyListDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyListDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyLongDerived.java =================================================================== --- branches/asm/src/org/python/core/PyLongDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyLongDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyModuleDerived.java =================================================================== --- branches/asm/src/org/python/core/PyModuleDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyModuleDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -881,29 +881,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1043,6 +1057,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyObjectDerived.java =================================================================== --- branches/asm/src/org/python/core/PyObjectDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyObjectDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyPropertyDerived.java =================================================================== --- branches/asm/src/org/python/core/PyPropertyDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyPropertyDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PySetDerived.java =================================================================== --- branches/asm/src/org/python/core/PySetDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PySetDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PySliceDerived.java =================================================================== --- branches/asm/src/org/python/core/PySliceDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PySliceDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PyStringDerived.java =================================================================== --- branches/asm/src/org/python/core/PyStringDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PyStringDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1]); return; } super.__delslice__(start,stop,step); @@ -1067,6 +1081,19 @@ } } + public PyObject __index__() { + PyType self_type=getType(); + PyObject impl=self_type.lookup("__index__"); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(); + if (res instanceof PyInteger||res instanceof PyLong) { + return res; + } + throw Py.TypeError(String.format("__index__ returned non-(int,long) (type %s)",res.getType().fastGetName())); + } + return super.__index__(); + } + public Object __tojava__(Class c) { // If we are not being asked by the "default" conversion to java, then // we can provide this as the result, as long as it is a instance of the Modified: branches/asm/src/org/python/core/PySuperDerived.java =================================================================== --- branches/asm/src/org/python/core/PySuperDerived.java 2008-07-28 06:38:44 UTC (rev 5007) +++ branches/asm/src/org/python/core/PySuperDerived.java 2008-07-28 06:40:09 UTC (rev 5008) @@ -905,29 +905,43 @@ } public PyObject __getslice__(PyObject start,PyObject stop,PyObject step) { // ??? + if (step!=null) { + return __getitem__(new PySlice(start,stop,step)); + } PyType self_type=getType(); PyObject impl=self_type.lookup("__getslice__"); if (impl!=null) { - return impl.__get__(this,self_type).__call__(start,stop); + PyObject[]indices=PySlice.indices2(this,start,stop); + return impl.__get__(this,self_type).__call__(indices[0],indices[1]); } return super.__getslice__(start,stop,step); } public void __setslice__(PyObject start,PyObject stop,PyObject step,PyObject value) { + if (step!=null) { + __setitem__(new PySlice(start,stop,step),value); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__setslice__"); if (impl!=null) { - impl.__get__(this,self_type).__call__(start,stop,value); + PyObject[]indices=PySlice.indices2(this,start,stop); + impl.__get__(this,self_type).__call__(indices[0],indices[1],value); return; } super.__setslice__(start,stop,step,value); } public void __delslice__(PyObject start,PyObject stop,PyObject step) { + if (step!=null) { + __delitem__(new PySlice(start,stop,step)); + return; + } PyType self_type=getType(); PyObject impl=self_type.lookup("__delslice__"); if (impl!=null) { - impl.__get_... [truncated message content] |