Re: [C++-sig] Getting object for PyObject (reference counting)

2010-02-11 Thread Ralf W. Grosse-Kunstleve
>boost::python::object cppobject(boost::python::handle<>(cObject)); It should work like this: boost::python::object cppobject((boost::python::handle<>(cObject))); (Not that I ever understood exactly why... (or even wanted to understand)) ___ Cplus

[C++-sig] Exceptions with pybindgen and gccxmlparser

2010-02-11 Thread James Vogel
Hello -- Trying to use pybindgen.gccxmlparser, and running into an issue with exception handling. I have a virtual class that declares virtual int throw_error() throw (std::exception); and a non-virtual class that extends the virtual class and overrides throw_an_error to throw an actual error.

Re: [C++-sig] boost::python and Date/Time values

2010-02-11 Thread troy d. straszheim
Murray Cumming wrote: On Sun, 2010-02-07 at 22:59 +0100, Murray Cumming wrote: Is there any easy way to get python Date, Time and DateTime values from boost::python::objects? In C, I'm using PyDateTime_GET_YEAR(), PyDateTime_GET_MONTH(), PyDateTime_GET_DAY(), etc, but it would be nice to use som

Re: [C++-sig] boost::python and Date/Time values

2010-02-11 Thread Murray Cumming
On Sun, 2010-02-07 at 22:59 +0100, Murray Cumming wrote: > Is there any easy way to get python Date, Time and DateTime values from > boost::python::objects? In C, I'm using PyDateTime_GET_YEAR(), > PyDateTime_GET_MONTH(), PyDateTime_GET_DAY(), etc, but it would be nice > to use some C++ API for thi

Re: [C++-sig] Getting object for PyObject (reference counting)

2010-02-11 Thread Stefan Seefeld
On 02/11/2010 07:18 AM, Murray Cumming wrote: On Fri, 2009-02-27 at 15:18 -0800, Alex Mohr wrote: [snip] If you have a PyObject *p and you want a bp::object, construct it via: object(handle<>(p)) // when p's a new reference I find that I have to split the handle and objec

Re: [C++-sig] Getting object for PyObject (reference counting)

2010-02-11 Thread Murray Cumming
On Fri, 2009-02-27 at 15:18 -0800, Alex Mohr wrote: [snip] > If you have a PyObject *p and you want a bp::object, > construct it via: > > object(handle<>(p)) // when p's a new reference I find that I have to split the handle and object over two lines. If I do this boost::python::obj