[C++-sig] What if a Python override returns several values?

Matthias Baas baas at ira.uka.de
Tue Sep 5 19:30:27 CEST 2006


Alex Mohr wrote:
>>      void g(int& a, int& b)
>>      {
>>          boost::python::tuple tup = this->get_override("g")();
>>
>> 	a = ...extract an int from tup[0]...
>>          b = ...extract an int from tup[1]...
>>      }
>>
>> But when I run this code I get the following error at runtime:
>>
>> TypeError: No registered converter was able to extract a C++ reference 
>> to type boost::python::tuple from this Python object of type tuple
> 
> [...]
> Off the top of my head, I think this would probably work for you:
> 
> tuple tup = call<tuple>(this->get_override("g").ptr());

Excellent! This works, thanks!

- Matthias -




More information about the Cplusplus-sig mailing list