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:
Daniel Veillard 2002-10-20 21:31:50 +00:00
parent 4826743d16
commit c0ac069982
2 changed files with 33 additions and 4 deletions

View File

@ -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

View File

@ -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;