From: <pj...@us...> - 2008-10-30 06:07:06
|
Revision: 5530 http://jython.svn.sourceforge.net/jython/?rev=5530&view=rev Author: pjenvey Date: 2008-10-30 06:07:01 +0000 (Thu, 30 Oct 2008) Log Message: ----------- Derived changes for r5529 __cmp__ results Modified Paths: -------------- trunk/jython/src/org/python/core/PyArrayDerived.java trunk/jython/src/org/python/core/PyBaseExceptionDerived.java trunk/jython/src/org/python/core/PyBooleanDerived.java trunk/jython/src/org/python/core/PyClassMethodDerived.java trunk/jython/src/org/python/core/PyComplexDerived.java trunk/jython/src/org/python/core/PyDictionaryDerived.java trunk/jython/src/org/python/core/PyEnumerateDerived.java trunk/jython/src/org/python/core/PyFileDerived.java trunk/jython/src/org/python/core/PyFloatDerived.java trunk/jython/src/org/python/core/PyFrozenSetDerived.java trunk/jython/src/org/python/core/PyIntegerDerived.java trunk/jython/src/org/python/core/PyListDerived.java trunk/jython/src/org/python/core/PyLongDerived.java trunk/jython/src/org/python/core/PyModuleDerived.java trunk/jython/src/org/python/core/PyObjectDerived.java trunk/jython/src/org/python/core/PyPropertyDerived.java trunk/jython/src/org/python/core/PySetDerived.java trunk/jython/src/org/python/core/PySliceDerived.java trunk/jython/src/org/python/core/PyStringDerived.java trunk/jython/src/org/python/core/PySuperDerived.java trunk/jython/src/org/python/core/PyTupleDerived.java trunk/jython/src/org/python/core/PyTypeDerived.java trunk/jython/src/org/python/core/PyUnicodeDerived.java trunk/jython/src/org/python/modules/_collections/PyDefaultDictDerived.java trunk/jython/src/org/python/modules/_collections/PyDequeDerived.java trunk/jython/src/org/python/modules/_csv/PyDialectDerived.java trunk/jython/src/org/python/modules/_functools/PyPartialDerived.java trunk/jython/src/org/python/modules/_weakref/ReferenceTypeDerived.java trunk/jython/src/org/python/modules/random/PyRandomDerived.java trunk/jython/src/org/python/modules/thread/PyLocalDerived.java trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java Modified: trunk/jython/src/org/python/core/PyArrayDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyArrayDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyArrayDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyBaseExceptionDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyBaseExceptionDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyBaseExceptionDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -752,11 +752,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyBooleanDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyBooleanDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyBooleanDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyClassMethodDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyClassMethodDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyClassMethodDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyComplexDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyComplexDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyComplexDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyDictionaryDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyDictionaryDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyDictionaryDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyEnumerateDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyEnumerateDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyEnumerateDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyFileDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyFileDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyFileDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyFloatDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyFloatDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyFloatDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyFrozenSetDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyFrozenSetDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyFrozenSetDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyIntegerDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyIntegerDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyIntegerDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyListDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyListDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyListDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyLongDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyLongDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyLongDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyModuleDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyModuleDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyModuleDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -752,11 +752,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyObjectDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyObjectDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyObjectDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyPropertyDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyPropertyDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyPropertyDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PySetDerived.java =================================================================== --- trunk/jython/src/org/python/core/PySetDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PySetDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PySliceDerived.java =================================================================== --- trunk/jython/src/org/python/core/PySliceDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PySliceDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyStringDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyStringDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyStringDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PySuperDerived.java =================================================================== --- trunk/jython/src/org/python/core/PySuperDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PySuperDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyTupleDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyTupleDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyTupleDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyTypeDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyTypeDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyTypeDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -752,11 +752,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/core/PyUnicodeDerived.java =================================================================== --- trunk/jython/src/org/python/core/PyUnicodeDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/core/PyUnicodeDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -776,11 +776,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/_collections/PyDefaultDictDerived.java =================================================================== --- trunk/jython/src/org/python/modules/_collections/PyDefaultDictDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/_collections/PyDefaultDictDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -778,11 +778,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/_collections/PyDequeDerived.java =================================================================== --- trunk/jython/src/org/python/modules/_collections/PyDequeDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/_collections/PyDequeDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -778,11 +778,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/_csv/PyDialectDerived.java =================================================================== --- trunk/jython/src/org/python/modules/_csv/PyDialectDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/_csv/PyDialectDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -754,11 +754,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/_functools/PyPartialDerived.java =================================================================== --- trunk/jython/src/org/python/modules/_functools/PyPartialDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/_functools/PyPartialDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -754,11 +754,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/_weakref/ReferenceTypeDerived.java =================================================================== --- trunk/jython/src/org/python/modules/_weakref/ReferenceTypeDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/_weakref/ReferenceTypeDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -778,11 +778,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/random/PyRandomDerived.java =================================================================== --- trunk/jython/src/org/python/modules/random/PyRandomDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/random/PyRandomDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -778,11 +778,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/thread/PyLocalDerived.java =================================================================== --- trunk/jython/src/org/python/modules/thread/PyLocalDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/thread/PyLocalDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -754,11 +754,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { Modified: trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java =================================================================== --- trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java 2008-10-30 06:06:03 UTC (rev 5529) +++ trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java 2008-10-30 06:07:01 UTC (rev 5530) @@ -754,11 +754,11 @@ return super.__cmp__(other); } PyObject res=impl.__get__(this,self_type).__call__(other); - if (res instanceof PyInteger) { - int v=((PyInteger)res).getValue(); - return v<0?-1:v>0?1:0; + if (res==Py.NotImplemented) { + return-2; } - throw Py.TypeError("__cmp__ should return a int"); + int c=res.asInt(); + return c<0?-1:c>0?1:0; } public boolean __nonzero__() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |