[Xapian-discuss] Python bindings...

Olly Betts olly at survex.com
Sun Dec 11 07:23:45 GMT 2005


On Sun, Dec 11, 2005 at 04:12:31AM +0000, Olly Betts wrote:
> I now have a typemap which matches the appropriate calls from Python,
> but the PyObject pointers I get from PyList_GetItem aren't instances
> according to PyInstance_Check.  If I ignore that, then I get a SEGV.
> So currently I'm a bit stumped what to try.

After a lot of digging, it appears that objects in python extension
classes are never instances, so I think that code must have been written
to try to get the "vector<Query>" version working, but it has never
actually worked.

So I simply rewrote the function in question, and now this one works
too!

I'll check this in shortly, then maybe have a quick play to see if it's
easy to support a mixture of strings and Query objects.
 
> Incidentally, any idea why the wrapping for vector<Query> looks for
> a Python sequence while the vector<string> case looks for a Python
> list?

Answering myself (after I discovered some documentation in comments in
python header files) a sequence is an abstraction which could be a list,
tuple, or other similar type (like an ordered container in C++).  So
I've moved both wrappers to use the sequence interface.

Cheers,
    Olly



More information about the Xapian-discuss mailing list