[C++-sig] Boost.Python type registry

François Duranleau duranlef at iro.umontreal.ca
Wed Oct 3 22:31:33 CEST 2007

On Wed, 3 Oct 2007, Giovanni Beltrame wrote:

> Hello everybody,
> I am trying to understand how the Boost.Python type registry works...
> What I want to do is, given a python object (let's say a PyObject*), determine
> its wrapper C++ type_info.
> Theoretically, what I want to do is going name->PyObject->C++ type. Notice
> that the traditional extract<T> won't work for me as I want to determine which
> type is being wrapped.
> I know Boost.Python is doing this internally in some way, but I haven't
> figured it out yet.
> Can anybody help?

AFAIK, there is nothing in the API to help you there. Boost.Python doesn't 
work directly this way internally. It provides a way to test if an 
instance holds a given type, but nothing to return the contained type 

Francois Duranleau

More information about the Cplusplus-sig mailing list