From c8c735b96348ead98a7ddeb25a5eed4912586396 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 21 May 2013 20:53:21 +0000 Subject: py_decref: Don't check for NULL before calling Py_DECREF. The only difference between Py_DECREF and Py_XDECREF is that the latter allows passing in a NULL object, while the former prohibits it. Given that, it's natural to expect the same from py_decref vs py_xdecref. gdb/ 2013-05-21 Pedro Alves * python/py-prettyprint.c (apply_val_pretty_printer): Check whether PRINTER is NULL before installing a Py_DECREF cleanup. * python/py-utils.c (py_decref): Don't check for NULL before calling Py_DECREF. --- gdb/python/py-utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gdb/python/py-utils.c') diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c index 80bacf7..7c7c5ca 100644 --- a/gdb/python/py-utils.c +++ b/gdb/python/py-utils.c @@ -31,8 +31,7 @@ py_decref (void *p) { PyObject *py = p; - if (py) - Py_DECREF (py); + Py_DECREF (py); } /* Return a new cleanup which will decrement the Python object's -- cgit v1.1