String className = PyException.exceptionClassName(type); int lastDot = className.lastIndexOf('.'); if (lastDot != -1) {
@Override public void __del_builtin__() { if (gi_frame == null || gi_frame.f_lasti == -1) { return; } try { close(); } catch (PyException pye) { // PEP 342 specifies that if an exception is raised by close, // we output to stderr and then forget about it; String className = PyException.exceptionClassName(pye.type); int lastDot = className.lastIndexOf('.'); if (lastDot != -1) { className = className.substring(lastDot + 1); } String msg = String.format("Exception %s: %s in %s", className, pye.value.__repr__(), __repr__()); Py.println(Py.getSystemState().stderr, Py.newString(msg)); } catch (Throwable t) { // but we currently ignore any Java exception completely. perhaps we // can also output something meaningful too? } }