On Thu, Sep 21, 2006 at 05:52:21PM -0500, Ross J. Reedstrom wrote:
> Forwarding for a colleague who can't seem to get his email subscription
> to work.
I didn't see any bounce, very strange, try again !
> He's starting with a quote of an email from Daniel earlier up
> the list, when we ran over the missing python implemention of the range
> types.
okay
> ----- Forwarded message from "Brian N. West" <[EMAIL PROTECTED]> -----
>
> Delivery-date: Thu, 21 Sep 2006 15:51:52 -0500
> Date: Thu, 21 Sep 2006 15:44:46 -0500
> From: "Brian N. West" <[EMAIL PROTECTED]>
> To: "Ross J. Reedstrom" <[EMAIL PROTECTED]>
> Subject: xml mailing list ...
>
> Daniel Veillard said:
> > Hum, yeah, that must be the binding missing support from the extra
> > XPath types (XPATH_POINT, XPATH_RANGE and XPATH_LOCATIONSET), I guess
> > nobody tried to really use them from Python, you're in unknown land.
> > Probably libxml_xmlXPathObjectPtrWrap() should be augmented to
> > handle them (python/types.c around line 397), and convert them to Python
> > type. I don't know what would be the best way to represent a point,
> > maybe a tuple made of a node and an index.
> > I would be glad to get patches and some example to run the regression
> tests
> > from python/test/ !
> >
> > Thanks in advance :-)
>
>
> We made the following changes to libxml_xmlXPathObjectPtrWrap():
>
> case XPATH_POINT:
>
> We create a 'point' tuple with contains the node and an index:
>
> node = libxml_xmlNodePtrWrap(obj->user);
> indexIntoNode = PyInt_FromLong((long) obj->index);
>
> ret = PyTuple_New(2);
> PyTuple_SetItem(ret, 0, node);
> PyTuple_SetItem(ret, 1, indexIntoNode);
>
> case XPATH_RANGE:
>
> We create a list (PyList) with two point tuples (PyTuples),
> or one point tuple if range is collapsed.
>
> case XPATH_LOCATIONSET:
>
> We create a list (PyList) with an entry per XPath Object contained in the
> location set. We call libxml_xmlXPathObjectPtrWrap() recursively for each
> XPath Object.
>
> for our python test of interest:
>
> xp='xpointer(string-range(id("para1"),"Geometric",9,1))'
>
> libxml_xmlXPathObjectPtrWrap() gets called with a Location Set with one
> XPath Object which is a Range. We build :
>
> a PyList (Location Set) which contain one PyList (Range)
> which contains two point PyTuples.
Okay, that sound fine.
> At some point after libxml_xmlXPathObjectPtrWrap() is returned, a call is
> made to libxml_type() where we experience a memory access error. Within a
> call is made to
>
> PyArg_ParseTuple(args, (char *) "O:last", &obj)
>
> followed by
>
> cur = PyxmlNode_Get(obj)
>
> which leaves us with a 'cur' of value 1, instead of a valid memory pointer.
> Deferencing cur causes the memory access error.
Hum, you need to chase where this is really coming from, it's hard to infer
from the stack trace since whatever called libxml_type() is not shown.
It is likely to be in the wrapper taking the low level python object
to convert it to a instance of the classes in libxml2.py . Check
xmlCore.get_type, add debug there if necessary. Check the wrapper when
doing the reentrancy in the .py code when returning from C.
> It is a mystery to us why libxml_type() is being called.
>
> Any thoughts?
Something is being seen as an xmlCore (i.e. a node) and that is used
when building a node instance from a low level wrapper object. Add
debug around get_type()
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
[EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml