Re: [xml-bindings]Parameter passing convention in extension functions ...
- From: rm fabula de
- To: Daniel Veillard <veillard redhat com>
- Cc: rm fabula de, xml-bindings gnome org
- Subject: Re: [xml-bindings]Parameter passing convention in extension functions ...
- Date: Wed, 21 Aug 2002 22:27:38 +0200
On Wed, Aug 21, 2002 at 01:04:44PM -0400, Daniel Veillard wrote:
> On Wed, Aug 21, 2002 at 06:54:29PM +0200, rm fabula de wrote:
[...]
> > As another question: when i call <xsl:value-of select='foo:bar(.)' />
> > what is the type of the parameter. A call print in python emits
> > '[<PyCObject object at 0x8189770>]' which doesn't seem to help a lot.
> > Is there any way to work on/with such a parameter from within python?
>
> That's a problem that Norm Walsh faced too and I didn't managed to
> find the problem in a 15mn debugging session, seems I really need to focuse
> on this one, could you bugzilla it ?
Ok, got it. So, the 'thingy' coming in is actually an xml node object,
but i lacks the outermost Python wrapper (i recall a mail i sent a while
ago concerning this extra layer of wrapping ...:-)
My quick fix is:
def f(ctxt, node):
realNode = libxml2.xmlNode(node)
....
I have to admit that i have a slighly bad feeling about this. This wrapping
should be done by the caller. A call to such a low level function should not
be neccessary in user code -- this is too fragile.
print libxml2.xmlNode(not_a_c_node) will segfault ...
Ralf
> Daniel
>
> --
> Daniel Veillard | Red Hat Network https://rhn.redhat.com/
> veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
> http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
> Index: python/libxslt.c
> ===================================================================
> RCS file: /cvs/gnome/libxslt/python/libxslt.c,v
> retrieving revision 1.12
> retrieving revision 1.13
> diff -c -r1.12 -r1.13
> *** python/libxslt.c 24 May 2002 13:03:04 -0000 1.12
> --- python/libxslt.c 21 Aug 2002 17:00:38 -0000 1.13
> ***************
> *** 107,113 ****
>
> list = PyTuple_New(nargs + 1);
> PyTuple_SetItem(list, 0, libxml_xmlXPathParserContextPtrWrap(ctxt));
> ! for (i = 0;i < nargs;i++) {
> obj = valuePop(ctxt);
> cur = libxml_xmlXPathObjectPtrWrap(obj);
> PyTuple_SetItem(list, i + 1, cur);
> --- 107,113 ----
>
> list = PyTuple_New(nargs + 1);
> PyTuple_SetItem(list, 0, libxml_xmlXPathParserContextPtrWrap(ctxt));
> ! for (i = nargs - 1;i >= 0;i--) {
> obj = valuePop(ctxt);
> cur = libxml_xmlXPathObjectPtrWrap(obj);
> PyTuple_SetItem(list, i + 1, cur);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]