diff options
author | Guido van Rossum <guido@python.org> | 2002-08-09 17:39:14 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-09 17:39:14 (GMT) |
commit | 4030714a93afacdcb4783f37320c48b4ad99da87 (patch) | |
tree | c4e817db45883dcfb4cee2eaa2dff01cc56d01fe /Modules/gcmodule.c | |
parent | 4aa21aa5b331183af372c1d0a8e59be997f78c33 (diff) | |
download | cpython-4030714a93afacdcb4783f37320c48b4ad99da87.zip cpython-4030714a93afacdcb4783f37320c48b4ad99da87.tar.gz cpython-4030714a93afacdcb4783f37320c48b4ad99da87.tar.bz2 |
For new-style classes, we can now test for tp_del instead of asking
for a __del__ attribute, to see if there's a finalizer.
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r-- | Modules/gcmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index e0c7631..bae2653 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -346,9 +346,9 @@ has_finalizer(PyObject *op) if (delstr == NULL) Py_FatalError("PyGC: can't initialize __del__ string"); } - return (PyInstance_Check(op) || - PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) - && PyObject_HasAttr(op, delstr); + return PyInstance_Check(op) ? PyObject_HasAttr(op, delstr) : + PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE) ? + op->ob_type->tp_del != NULL : 0; } /* Move all objects with finalizers (instances with __del__) */ |