0015-python-return-NULL-if-set_list_of_xml_nodes-fails-44.patch
bindings/python/lang.py | ||
---|---|---|
820 | 820 |
if is_cstring(el_type): |
821 | 821 |
print_(' RETURN_IF_FAIL(set_list_of_strings(&this->%s, cvt_value));' % name, file=fd) |
822 | 822 |
elif is_xml_node(el_type): |
823 |
print_(' set_list_of_xml_nodes(&this->%s, cvt_value);' % name, file=fd)
|
|
823 |
print_(' RETURN_IF_FAIL(set_list_of_xml_nodes(&this->%s, cvt_value));' % name, file=fd)
|
|
824 | 824 |
elif is_object(el_type): |
825 | 825 |
print_(' set_list_of_pygobject(&this->%s, cvt_value);' % name, file=fd) |
826 | 826 |
else: |
... | ... | |
983 | 983 |
if is_cstring(qualifier): |
984 | 984 |
print_(' EXIT_IF_FAIL(set_list_of_strings(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd) |
985 | 985 |
elif is_xml_node(qualifier): |
986 |
print_(' set_list_of_xml_nodes(&%s, cvt_%s);' % (arg[1], arg[1]), file=fd)
|
|
986 |
print_(' EXIT_IF_FAIL(set_list_of_xml_nodes(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
|
|
987 | 987 |
elif isinstance(qualifier, str) and qualifier.startswith('Lasso'): |
988 | 988 |
print_(' set_list_of_pygobject(&%s, cvt_%s);' % (arg[1], arg[1]), file=fd) |
989 | 989 |
else: |
bindings/python/wrapper_top.c | ||
---|---|---|
92 | 92 |
G_GNUC_UNUSED static int set_hashtable_of_pygobject(GHashTable *a_hash, PyObject *dict); |
93 | 93 |
G_GNUC_UNUSED static int set_hashtable_of_strings(GHashTable *a_hash, PyObject *dict); |
94 | 94 |
G_GNUC_UNUSED static int set_list_of_strings(GList **a_list, PyObject *seq); |
95 |
G_GNUC_UNUSED static void set_list_of_xml_nodes(GList **a_list, PyObject *seq);
|
|
95 |
G_GNUC_UNUSED static int set_list_of_xml_nodes(GList **a_list, PyObject *seq);
|
|
96 | 96 |
G_GNUC_UNUSED static void set_list_of_pygobject(GList **a_list, PyObject *seq); |
97 | 97 |
G_GNUC_UNUSED static PyObject *get_list_of_strings(const GList *a_list); |
98 | 98 |
G_GNUC_UNUSED static PyObject *get_list_of_xml_nodes(const GList *a_list); |
... | ... | |
361 | 361 |
/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList |
362 | 362 |
* created by converting the python seq into a GList of xmlNode*. |
363 | 363 |
*/ |
364 |
static void |
|
364 |
int |
|
365 | 365 |
set_list_of_xml_nodes(GList **a_list, PyObject *seq) { |
366 | 366 |
GList *list = NULL; |
367 |
int l = 0,i; |
|
367 |
int l = 0, i;
|
|
368 | 368 | |
369 |
lasso_return_if_fail(valid_seq(seq)); |
|
369 |
if (! valid_seq(seq)) { |
|
370 |
PyErr_SetString(PyExc_TypeError, |
|
371 |
"value should be a tuple of strings"); |
|
372 |
return 0; |
|
373 |
} |
|
370 | 374 |
if (seq != Py_None) { |
371 | 375 |
l = PySequence_Length(seq); |
372 | 376 |
} |
... | ... | |
379 | 383 |
goto failure; |
380 | 384 |
} |
381 | 385 |
item_node = get_xml_node_from_pystring(item); |
386 |
if (! item_node) { |
|
387 |
PyErr_SetString(PyExc_TypeError, |
|
388 |
"values should be valid XML fragments"); |
|
389 |
goto failure; |
|
390 |
} |
|
382 | 391 |
list = g_list_append(list, item_node); |
383 | 392 |
} |
384 | 393 |
free_list(a_list, (GFunc)xmlFreeNode); |
385 | 394 |
*a_list = list; |
386 |
return; |
|
395 |
return 1;
|
|
387 | 396 |
failure: |
388 | 397 |
free_list(&list, (GFunc)xmlFreeNode); |
398 |
return 0; |
|
389 | 399 |
} |
390 | 400 | |
391 | 401 |
/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList |
392 |
- |