From 3c83bfb14b850670eb7c0208e55c120ca203f8af Mon Sep 17 00:00:00 2001 From: Simon Feltman Date: Sat, 27 Jul 2013 21:10:07 -0700 Subject: Use Py_CLEAR for closure cleanup instead of test with Py_DECREF --- gi/pygi-closure.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c index 99e15a11..601db94b 100644 --- a/gi/pygi-closure.c +++ b/gi/pygi-closure.c @@ -518,15 +518,8 @@ _pygi_invoke_closure_clear_py_data(PyGICClosure *invoke_closure) { PyGILState_STATE state = PyGILState_Ensure(); - if (invoke_closure->function != NULL) { - Py_DECREF (invoke_closure->function); - invoke_closure->function = NULL; - } - - if (invoke_closure->user_data != NULL) { - Py_DECREF (invoke_closure->user_data); - invoke_closure->user_data = NULL; - } + Py_CLEAR (invoke_closure->function); + Py_CLEAR (invoke_closure->user_data); PyGILState_Release (state); } -- cgit v1.2.1