[C++-sig] from_python non-compiletime-constant
David Abrahams
dave at boost-consulting.com
Thu Nov 23 22:45:17 CET 2006
Neal Becker <ndbecker2 at gmail.com> writes:
> I need to register a from_python conversion where the type object is not a
> compile constant. I'm trying to write c++ code that will accept a numpy
> array.
>
> AFAICT, the PyTypeObject addresses aren't known at compile time, so can't be
> used in lvalue_from_pytype template arguments. These pointers can be found
> at runtime. How do I handle this?
Just take apart the implementation of lvalue_from_pytype and you'll
find lower-level facilities in use that will let you build a similar
converter. Unfortunately the code for lvalue_from_pytype is pretty
convoluted but I've posted the solution several times before on this
list so you should be able to find it.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list