[C++-sig] PyObject_Call() wrapper ?

Stefan Seefeld seefeld at sympatico.ca
Thu Oct 11 19:09:21 CEST 2007


Alex Mohr wrote:
>> I'm looking for the boost.python equivalent of the generic
>>
>> callable(*args, **kwds)

[...]

> I think it would be awesome if you did it -- I think these are the cases:

I just submitted a patch:

http://svn.boost.org/trac/boost/ticket/1316

Reviews are highly welcome, especially from Dave. :-)

> object(a1, a2 .. aN)
> object(a1, a2 .. aN, *args)
> object(a1, a2 .. aN, **kw)
> object(a1, a2 .. aN, *args, **kw)

While these could all be implemented, the only one directly supported
by the Python C API (PyObject_Call()) is the one with N==0, i.e.
object(*args, **kw), so this is what my patch includes. Anything else
requires to manually rebuild the argument vector before passing it down.

(As a cosmetic point:  I'm not sure whether the code layout is ideal.
It may be better to put the additions into a separate file. Dave ?)


Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list