From: <le...@us...> - 2008-07-02 21:09:16
|
Revision: 4840 http://jython.svn.sourceforge.net/jython/?rev=4840&view=rev Author: leosoto Date: 2008-07-02 14:09:14 -0700 (Wed, 02 Jul 2008) Log Message: ----------- Syncing PyBaseExceptionDerived Modified Paths: -------------- branches/asm/src/org/python/core/PyBaseExceptionDerived.java Modified: branches/asm/src/org/python/core/PyBaseExceptionDerived.java =================================================================== --- branches/asm/src/org/python/core/PyBaseExceptionDerived.java 2008-07-02 20:17:29 UTC (rev 4839) +++ branches/asm/src/org/python/core/PyBaseExceptionDerived.java 2008-07-02 21:09:14 UTC (rev 4840) @@ -529,104 +529,156 @@ public PyObject __iadd__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__iadd__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__iadd__(other); } public PyObject __isub__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__isub__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__isub__(other); } public PyObject __imul__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__imul__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__imul__(other); } public PyObject __idiv__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__idiv__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__idiv__(other); } public PyObject __ifloordiv__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__ifloordiv__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__ifloordiv__(other); } public PyObject __itruediv__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__itruediv__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__itruediv__(other); } public PyObject __imod__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__imod__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__imod__(other); } public PyObject __ipow__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__ipow__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__ipow__(other); } public PyObject __ilshift__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__ilshift__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__ilshift__(other); } public PyObject __irshift__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__irshift__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__irshift__(other); } public PyObject __iand__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__iand__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__iand__(other); } public PyObject __ior__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__ior__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__ior__(other); } public PyObject __ixor__(PyObject other) { PyType self_type=getType(); PyObject impl=self_type.lookup("__ixor__"); - if (impl!=null) - return impl.__get__(this,self_type).__call__(other); + if (impl!=null) { + PyObject res=impl.__get__(this,self_type).__call__(other); + if (res==Py.NotImplemented) + return null; + return res; + } return super.__ixor__(other); } @@ -659,12 +711,17 @@ PyObject impl=self_type.lookup("__hash__"); if (impl!=null) { PyObject res=impl.__get__(this,self_type).__call__(); - if (res instanceof PyInteger) + if (res instanceof PyInteger) { return((PyInteger)res).getValue(); + } else + if (res instanceof PyLong) { + return((PyLong)res).getValue().intValue(); + } throw Py.TypeError("__hash__ should return a int"); } - if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) + if (self_type.lookup("__eq__")!=null||self_type.lookup("__cmp__")!=null) { throw Py.TypeError("unhashable type"); + } return super.hashCode(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |