[C++-sig] strange registry behavior

Jonathan Wang jontwang at gmail.com
Mon Dec 18 20:17:16 CET 2006


On 12/18/06, Ralf W. Grosse-Kunstleve <rwgk at yahoo.com> wrote:
>
>
> Hi Jonathan,
>
> > >>> baz = foo + bar
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> >   File "/home/jwang1/eqvol/Analytic2/python/vector.py", line 75, in
> __add__
> >     return Vector(extract.getResult(calc))
> > TypeError: No Python class registered for C++ class std::vector<double,
> std::allocator<double> >
>
> It is difficult to help.
> What is Vector? A Python class?
> What is extract?
> What is calc?
> Does this fail?
>   r = extract.getResult(calc)
> Or this?
>   Vector(r)


Nevermind... I figured this out. The vector was getting returned with
return_internal_reference call policy, which requires a class to be
registered, not just a result converter. Switching the call policy fixed
things.

Thanks,
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20061218/e5cd4e01/attachment.htm>


More information about the Cplusplus-sig mailing list