From: <le...@us...> - 2008-08-11 05:35:26
|
Revision: 5144 http://jython.svn.sourceforge.net/jython/?rev=5144&view=rev Author: leosoto Date: 2008-08-11 05:35:18 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Really fix coercion on derived this time 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/PyObject.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/_csv/PyDialectDerived.java branches/asm/src/org/python/modules/_functools/PyPartialDerived.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 branches/asm/src/templates/object.derived Modified: branches/asm/src/org/python/core/PyArrayDerived.java =================================================================== --- branches/asm/src/org/python/core/PyArrayDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyArrayDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyBaseExceptionDerived.java =================================================================== --- branches/asm/src/org/python/core/PyBaseExceptionDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyBaseExceptionDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1092,10 +1092,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyBooleanDerived.java =================================================================== --- branches/asm/src/org/python/core/PyBooleanDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyBooleanDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyClassMethodDerived.java =================================================================== --- branches/asm/src/org/python/core/PyClassMethodDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyClassMethodDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyComplexDerived.java =================================================================== --- branches/asm/src/org/python/core/PyComplexDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyComplexDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyDictionaryDerived.java =================================================================== --- branches/asm/src/org/python/core/PyDictionaryDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyDictionaryDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyEnumerateDerived.java =================================================================== --- branches/asm/src/org/python/core/PyEnumerateDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyEnumerateDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyFileDerived.java =================================================================== --- branches/asm/src/org/python/core/PyFileDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyFileDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyFloatDerived.java =================================================================== --- branches/asm/src/org/python/core/PyFloatDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyFloatDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyFrozenSetDerived.java =================================================================== --- branches/asm/src/org/python/core/PyFrozenSetDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyFrozenSetDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyIntegerDerived.java =================================================================== --- branches/asm/src/org/python/core/PyIntegerDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyIntegerDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyListDerived.java =================================================================== --- branches/asm/src/org/python/core/PyListDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyListDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyLongDerived.java =================================================================== --- branches/asm/src/org/python/core/PyLongDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyLongDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyModuleDerived.java =================================================================== --- branches/asm/src/org/python/core/PyModuleDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyModuleDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1092,10 +1092,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyObject.java =================================================================== --- branches/asm/src/org/python/core/PyObject.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyObject.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -936,9 +936,10 @@ * Implements numeric coercion * * @param o the other object involved in the coercion - * @return null if no coercion is possible; - * a single PyObject to use to replace o if this is unchanged; - * or a PyObject[2] consisting of replacements for this and o. + * @return null if coercion is not implemented + * Py.None if coercion was not possible + * a single PyObject to use to replace o if this is unchanged; + * or a PyObject[2] consisting of replacements for this and o. **/ public Object __coerce_ex__(PyObject o) { return null; Modified: branches/asm/src/org/python/core/PyObjectDerived.java =================================================================== --- branches/asm/src/org/python/core/PyObjectDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyObjectDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyPropertyDerived.java =================================================================== --- branches/asm/src/org/python/core/PyPropertyDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyPropertyDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PySetDerived.java =================================================================== --- branches/asm/src/org/python/core/PySetDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PySetDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PySliceDerived.java =================================================================== --- branches/asm/src/org/python/core/PySliceDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PySliceDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyStringDerived.java =================================================================== --- branches/asm/src/org/python/core/PyStringDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyStringDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PySuperDerived.java =================================================================== --- branches/asm/src/org/python/core/PySuperDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PySuperDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyTupleDerived.java =================================================================== --- branches/asm/src/org/python/core/PyTupleDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyTupleDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyTypeDerived.java =================================================================== --- branches/asm/src/org/python/core/PyTypeDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyTypeDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1092,10 +1092,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/core/PyUnicodeDerived.java =================================================================== --- branches/asm/src/org/python/core/PyUnicodeDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/core/PyUnicodeDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1116,10 +1116,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/_csv/PyDialectDerived.java =================================================================== --- branches/asm/src/org/python/modules/_csv/PyDialectDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/_csv/PyDialectDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1094,10 +1094,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/_functools/PyPartialDerived.java =================================================================== --- branches/asm/src/org/python/modules/_functools/PyPartialDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/_functools/PyPartialDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1094,10 +1094,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/_weakref/ReferenceTypeDerived.java =================================================================== --- branches/asm/src/org/python/modules/_weakref/ReferenceTypeDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/_weakref/ReferenceTypeDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1118,10 +1118,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/collections/PyDefaultDictDerived.java =================================================================== --- branches/asm/src/org/python/modules/collections/PyDefaultDictDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/collections/PyDefaultDictDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1118,10 +1118,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/collections/PyDequeDerived.java =================================================================== --- branches/asm/src/org/python/modules/collections/PyDequeDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/collections/PyDequeDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1118,10 +1118,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/random/PyRandomDerived.java =================================================================== --- branches/asm/src/org/python/modules/random/PyRandomDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/random/PyRandomDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1118,10 +1118,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/thread/PyLocalDerived.java =================================================================== --- branches/asm/src/org/python/modules/thread/PyLocalDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/thread/PyLocalDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1094,10 +1094,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/org/python/modules/zipimport/zipimporterDerived.java =================================================================== --- branches/asm/src/org/python/modules/zipimport/zipimporterDerived.java 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/org/python/modules/zipimport/zipimporterDerived.java 2008-08-11 05:35:18 UTC (rev 5144) @@ -1094,10 +1094,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res==null||res==Py.None) - return res; + if (res==Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return((PyTuple)res).getArray(); } return super.__coerce_ex__(o); Modified: branches/asm/src/templates/object.derived =================================================================== --- branches/asm/src/templates/object.derived 2008-08-11 04:09:35 UTC (rev 5143) +++ branches/asm/src/templates/object.derived 2008-08-11 05:35:18 UTC (rev 5144) @@ -450,10 +450,10 @@ PyObject impl=self_type.lookup("__coerce__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(o); - if (res == null || res == Py.None) - return res; + if (res == Py.NotImplemented) + return Py.None; if (!(res instanceof PyTuple)) - throw Py.TypeError("coercion should return None or 2-tuple"); + throw Py.TypeError("__coerce__ didn't return a 2-tuple"); return ((PyTuple)res).getArray(); } return super.__coerce_ex__(o); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |