Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread David Abrahams
on Wed Oct 29 2008, Hans Meine wrote: > On Mittwoch 29 Oktober 2008, David Abrahams wrote: >> The above should be a complete guide. Any questions? > > Great, thanks a lot for the write-up. I think my second question is still > left, at least from your post and the docs at > http://www.boost.o

Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread David Abrahams
on Wed Oct 29 2008, "Dan Eloff" wrote: > On Wed, Oct 29, 2008 at 3:55 PM, David Abrahams <[EMAIL PROTECTED]> wrote: >> The above should be a complete guide. Any questions? > > Just two. > > 1) Should it be object(handle<>(borrowed(ptr))) or > object(borrowed(ptr)) ? Both seem to compile. *

Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread Dan Eloff
On Wed, Oct 29, 2008 at 3:55 PM, David Abrahams <[EMAIL PROTECTED]> wrote: > The above should be a complete guide. Any questions? Just two. 1) Should it be object(handle<>(borrowed(ptr))) or object(borrowed(ptr)) ? Both seem to compile. 2) Can I repost that to a boost::python wiki, givng you cr

Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread Hans Meine
On Mittwoch 29 Oktober 2008, David Abrahams wrote: > The above should be a complete guide. Any questions? Great, thanks a lot for the write-up. I think my second question is still left, at least from your post and the docs at http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/handle.html I

Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread David Abrahams
on Wed Oct 29 2008, Hans Meine wrote: > On Mittwoch 29 Oktober 2008, Dan Eloff wrote: >> When creating an object from a PyObject *, how do you distinguish >> between a PyObject pointer that is a new reference (must not be >> increfed, but must be decrefed) versus a PyObject * that is a borrowed

Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread Dan Eloff
On Wed, Oct 29, 2008 at 3:29 PM, Alex Mohr <[EMAIL PROTECTED]> wrote: > The documentation isn't great, but the name 'borrowed' is a hint. Using > borrowed instructs boost.python that the PyObject * is a borrowed reference. > So you can use: > > object(handle<>(borrowed(ptr))) > > for when ptr is

Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread Alex Mohr
The best I could find was object(borrowed(ptr)) for new references and object(handle<>(ptr)) for borrowed pointers. I'm not sure if that is accurate, but if so that deserves a nomination for a terrible interface award. The documentation isn't great, but the name 'borrowed' is a hint. Using bor

Re: [C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread Hans Meine
On Mittwoch 29 Oktober 2008, Dan Eloff wrote: > When creating an object from a PyObject *, how do you distinguish > between a PyObject pointer that is a new reference (must not be > increfed, but must be decrefed) versus a PyObject * that is a borrowed > reference? (should be increfed and decrefed)

[C++-sig] boost::python constructing object from PyObject *

2008-10-29 Thread Dan Eloff
When creating an object from a PyObject *, how do you distinguish between a PyObject pointer that is a new reference (must not be increfed, but must be decrefed) versus a PyObject * that is a borrowed reference? (should be increfed and decrefed) A very simple question for which there is no documen