mirror of
https://github.com/GNOME/libxml2.git
synced 2025-03-31 19:10:28 +08:00
fixed bugs when passing result value tree to Python functions. Daniel
* python/types.c: fixed bugs when passing result value tree to Python functions. Daniel
This commit is contained in:
parent
4826743d16
commit
c0ac069982
@ -1,3 +1,8 @@
|
||||
Sun Oct 20 23:31:47 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* python/types.c: fixed bugs when passing result value tree
|
||||
to Python functions.
|
||||
|
||||
Fri Oct 18 13:18:53 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* configure.in: preparing the release of 2.4.26
|
||||
|
@ -342,13 +342,37 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
|
||||
return (Py_None);
|
||||
}
|
||||
switch (obj->type) {
|
||||
case XPATH_XSLT_TREE:
|
||||
/* TODO !!!! Allocation problems */
|
||||
case XPATH_XSLT_TREE: {
|
||||
if ((obj->nodesetval == NULL) ||
|
||||
(obj->nodesetval->nodeNr == 0) ||
|
||||
(obj->nodesetval->nodeTab == NULL)) {
|
||||
ret = PyList_New(0);
|
||||
} else {
|
||||
int i, len = 0;
|
||||
xmlNodePtr node;
|
||||
|
||||
node = obj->nodesetval->nodeTab[0]->children;
|
||||
while (node != NULL) {
|
||||
len++;
|
||||
node = node->next;
|
||||
}
|
||||
ret = PyList_New(len);
|
||||
node = obj->nodesetval->nodeTab[0]->children;
|
||||
for (i = 0;i < len;i++) {
|
||||
PyList_SetItem(ret, i, libxml_xmlNodePtrWrap(node));
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Return now, do not free the object passed down
|
||||
*/
|
||||
return (ret);
|
||||
}
|
||||
case XPATH_NODESET:
|
||||
if ((obj->nodesetval == NULL)
|
||||
|| (obj->nodesetval->nodeNr == 0))
|
||||
|| (obj->nodesetval->nodeNr == 0)) {
|
||||
ret = PyList_New(0);
|
||||
else {
|
||||
} else {
|
||||
int i;
|
||||
xmlNodePtr node;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user