Update of /cvsroot/jython/jython/org/python/core
In directory usw-pr-cvs1:/tmp/cvs-serv12412
Modified Files:
PyInstance.java
Log Message:
Fix for "[ #475666 ] __nonzero__ exceptions must be ignored".
Index: PyInstance.java
===================================================================
RCS file: /cvsroot/jython/jython/org/python/core/PyInstance.java,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -d -r2.23 -r2.24
*** PyInstance.java 2001/08/11 10:39:32 2.23
--- PyInstance.java 2001/10/28 16:17:12 2.24
***************
*** 448,463 ****
public boolean __nonzero__() {
! PyObject ret = invoke_ex("__nonzero__");
! if (ret != null) {
! return ret.__nonzero__();
! }
!
try {
! return __len__() == 0 ? false : true;
! } catch (PyException exc) {
! if (Py.matchException(exc, Py.AttributeError))
return true;
- throw exc;
}
}
--- 448,471 ----
public boolean __nonzero__() {
! PyObject meth = null;
try {
! meth = __findattr__("__nonzero__");
! } catch (PyException exc) { }
!
! if (meth == null) {
! // Copied form __len__()
! CollectionProxy proxy = getCollection();
! if (proxy != CollectionProxy.NoProxy) {
! return proxy.__len__() != 0 ? true : false;
! }
! try {
! meth = __findattr__("__len__");
! } catch (PyException exc) { }
! if (meth == null)
return true;
}
+
+ PyObject ret = meth.__call__();
+ return ret.__nonzero__();
}
|