[C++-sig] accessing c++ attributes from python

Alex Mohr amohr at pixar.com
Fri Jul 18 23:18:14 CEST 2008


Gennadiy Rozental wrote:
> If I implement __getattr__ callback for C++ class, how do I report attribute
> "not found" condition so that KeyError is reported on python side?

Something like this?

PyErr_SetString(PyExc_KeyError, "your message");
boost::python::throw_error_already_set();

Alex




More information about the Cplusplus-sig mailing list