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.
--
[email protected]
www.murrayc.com
www.openismus.com
_
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: [email protected]
Sent: Friday, February 27, 2009 1:33:
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
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
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::
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
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
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
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