[Extending] Py_BuildValue( "((OiiO))",...) creates empty string?
Mike C. Fletcher
mcfletch at rogers.com
Sun Jun 16 14:54:35 EDT 2002
I'm working on a C module, and have come across something I don't
understand. Basically, I have a method definition/specification which
says I will pass my clients a 4-item tuple to their append method.
So, I want to call:
PyObject_CallObject( objectToCall, parameter );
With a parameter equal to:
(("this",1,2,[]),)
That is, a singleton tuple with a 4-item tuple as the first (and only)
item. Now, the docs for Py_BuildValue say I can create arbitrarily
nested tuples, so I would expect this:
parameter = Py_BuildValue( "((OiiO))", tagobj, childStart, childPosition,
childResults );
to create the appropriate tuple-structure. Unfortunately, it doesn't.
Instead it creates an empty string as far as I can tell (that's what my
Python test code receives, anyway).
I also tried it like this:
parameter = Py_BuildValue( "(N)", Py_BuildValue( "(OiiO)", tagobj,
childStart, childPosition, childResults ));
And again, got the same result (an empty string passed to my method).
Any clues from the C gurus as to what I'm doing wrong?
With thanks,
Mike
_______________________________________
Mike C. Fletcher
http://members.rogers.com/mcfletch/
More information about the Python-list
mailing list