[pygobject/gsoc2009: 55/160] Use Py_CLEAR when possible
- From: Simon van der Linden <svdlinden src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pygobject/gsoc2009: 55/160] Use Py_CLEAR when possible
- Date: Fri, 14 Aug 2009 21:26:42 +0000 (UTC)
commit 8112bb592b17167e8c5c8c46c866e9fa00db3259
Author: Simon van der Linden <svdlinden src gnome org>
Date: Thu Jul 23 10:43:37 2009 +0200
Use Py_CLEAR when possible
Use Py_CLEAR instead of Py_DECREF and assigning NULL.
gi/pygargument.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gi/pygargument.c b/gi/pygargument.c
index f39476d..d2a9817 100644
--- a/gi/pygargument.c
+++ b/gi/pygargument.c
@@ -1178,8 +1178,7 @@ struct_error_clean:
item = *(GArgument *)(array->data + item_size * i);
py_item = pygi_g_argument_to_py_object(item, item_type_info);
if (py_item == NULL) {
- Py_DECREF(object);
- object = NULL;
+ Py_CLEAR(object);
break;
}
@@ -1215,8 +1214,7 @@ struct_error_clean:
py_item = pygi_g_argument_to_py_object(item, item_type_info);
if (py_item == NULL) {
- Py_DECREF(object);
- object = NULL;
+ Py_CLEAR(object);
PyErr_PREFIX_FROM_FORMAT("Item %zd :", i);
break;
}
@@ -1266,8 +1264,7 @@ struct_error_clean:
Py_DECREF(py_value);
if (retval < 0) {
- Py_DECREF(object);
- object = NULL;
+ Py_CLEAR(object);
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]