[C++-sig] Automatic type conversion again

Albert Strasheim fullung at gmail.com
Tue May 8 23:45:43 CEST 2007


Hello all

Referring to Roman's excellent guide here:

http://www.language-binding.net/pyplusplus/troubleshooting_guide/automatic_conversion/automatic_conversion.html

Is there any way to allow conversion of PyObject* when passing to 
functions that expect references or pointers? In Roman's code he 
explicitly checks that doing this throws a TypeError:

http://www.language-binding.net/pyplusplus/troubleshooting_guide/automatic_conversion/test.py.html

e.g.

self.failUnlessRaises( TypeError, tuples.test_triplet_ref_110, (1,1,0) )

I can do this with SWIG typemaps, but SWIG doesn't seem to have a 
built-in equivalent for return_internal_reference or 
with_custodian_and_ward_postcall, so I'd like to stick to using 
Boost.Python if at all possible.

Any advice would be appreciated. Thanks.

Cheers,

Albert



More information about the Cplusplus-sig mailing list