📄 pyfinalizableinstance.java
字号:
// Copyright (c) Corporation for National Research Initiatives// These are just like normal instances, except that their classes included// a definition for __del__(), i.e. Python's finalizer. These two instance// types have to be separated due to Java performance issues.package org.python.core;/** * A python class instance with __del__ defined. * <p> * This is a special class due to performance. Defining * finalize() on a class, makes the class a lot slower. */public class PyFinalizableInstance extends PyInstance{ public PyFinalizableInstance(PyClass iclass) { super(iclass); } // __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"); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -