From: Finn B. <bc...@us...> - 2001-12-18 12:52:07
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv4912 Modified Files: PyFinalizableInstance.java Log Message: Print a message if the __del__() throws a exception. This closes bug "[ #494514 ] Python object not gc()'d". Index: PyFinalizableInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFinalizableInstance.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -d -r2.4 -r2.5 *** PyFinalizableInstance.java 2001/10/28 17:13:43 2.4 --- PyFinalizableInstance.java 2001/12/18 12:52:04 2.5 *************** *** 22,26 **** // __del__ method is invoked upon object finalization. protected void finalize() { ! __class__.__del__.__call__(this); } } --- 22,39 ---- // __del__ method is invoked upon object finalization. protected void finalize() { ! try { ! __class__.__del__.__call__(this); ! } catch (PyException exc) { ! // Try to get the right method description. ! PyObject method = __class__.__del__; ! try { ! method = __findattr__("__del__"); ! } catch (PyException e) { ; } ! ! Py.stderr.println("Exception " + ! Py.formatException(exc.type, exc.value, exc.traceback) + ! " in " + method + ! " ignored"); ! } } } |