]> granicus.if.org Git - python/commitdiff
has_finalizer(): simplified "if (complicated_bool) 1 else 0" to
authorTim Peters <tim.peters@gmail.com>
Thu, 1 Nov 2001 19:35:45 +0000 (19:35 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 1 Nov 2001 19:35:45 +0000 (19:35 +0000)
"complicated_bool".

Modules/gcmodule.c

index 0738eb67fff2e0649fedbe6a005a3e590036820d..08b57ac6220dd39d2ba459c78c804bc919ba88b5 100644 (file)
@@ -236,14 +236,9 @@ has_finalizer(PyObject *op)
                if (delstr == NULL)
                        Py_FatalError("PyGC: can't initialize __del__ string");
        }
-       if ((PyInstance_Check(op) ||
-            PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) &&
-           PyObject_HasAttr(op, delstr)) {
-               return 1;
-       }
-       else {
-               return 0;
-       }
+       return (PyInstance_Check(op) ||
+               PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE))
+              && PyObject_HasAttr(op, delstr);
 }
 
 /* Move all objects with finalizers (instances with __del__) */