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

2009-02-27 Thread Alex Mohr
Oh, I assumed that boost::python::object did this already. It does. Think of bp::handle<> as a low-level, bare-bones, smart PyObject*. Think of bp::object as that, *plus* all the fancy c++ API that maps to python API (like obj.attr("foo"), []-operator, ()-operator, etc). I believe bp::obj

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

2009-02-27 Thread AFoglia
Murray Cumming wrote: On Fri, 2009-02-27 at 08:34 -0800, Alex Mohr wrote: Murray Cumming wrote: I can't find any definitive documentation that tells me how I should get a boost::python::object to wrap an existing PyObject*. I guess that there's a way to do it that uses an existing reference, an

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

2009-02-27 Thread Murray Cumming
On Fri, 2009-02-27 at 08:34 -0800, Alex Mohr wrote: > Murray Cumming wrote: > > I can't find any definitive documentation that tells me how I should get > > a boost::python::object to wrap an existing PyObject*. I guess that > > there's a way to do it that uses an existing reference, and a way that

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

2009-02-27 Thread AFoglia
Murray Cumming wrote: On Fri, 2009-02-27 at 07:35 -0800, Ralf W. Grosse-Kunstleve wrote: The trick is to use boost::python::handle: http://www.boost.org/doc/libs/1_38_0/libs/python/doc/v2/handle.html For example: object python_file((handle<>(borrowed(obj_ptr; Thanks, but like much of th

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

2009-02-27 Thread Alex Mohr
Murray Cumming wrote: I can't find any definitive documentation that tells me how I should get a boost::python::object to wrap an existing PyObject*. I guess that there's a way to do it that uses an existing reference, and a way that takes an extra reference. You can construct a boost::python::

[C++-sig] [c++-sig] Making a Python tuple from a Boost.Fusion sequence

2009-02-27 Thread Bruno Lalande
Hello, The topic below was opened in the Boost development mailing list, where it's been pointed out to me that it fits better here. You can also read the thread archive: http://thread.gmane.org/gmane.comp.lib.boost.devel/186573 Regards Bruno -- Forwarded message -- Hello, I

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

2009-02-27 Thread Murray Cumming
On Fri, 2009-02-27 at 07:35 -0800, Ralf W. Grosse-Kunstleve wrote: > The trick is to use boost::python::handle: > > http://www.boost.org/doc/libs/1_38_0/libs/python/doc/v2/handle.html > > For example: > > object python_file((handle<>(borrowed(obj_ptr; Thanks, but like much of the documentat

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

2009-02-27 Thread Ralf W. Grosse-Kunstleve
The trick is to use boost::python::handle: http://www.boost.org/doc/libs/1_38_0/libs/python/doc/v2/handle.html For example: object python_file((handle<>(borrowed(obj_ptr; - Original Message From: Murray Cumming To: cplusplus-sig@python.org Sent: Friday, February 27, 2009 1:33:

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

2009-02-27 Thread Murray Cumming
I can't find any definitive documentation that tells me how I should get a boost::python::object to wrap an existing PyObject*. I guess that there's a way to do it that uses an existing reference, and a way that takes an extra reference. -- murr...@murrayc.com www.murrayc.com www.openismus.com _