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

AFoglia at princeton.com AFoglia at princeton.com
Fri Feb 27 18:19:12 CET 2009

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 the documentation, I find that page very
> unclear. Is there anything that states more obviously what should be
> done in the two cases I mentioned.

The best documentation I could find was this page on the Python wiki, 
taken from a email to this list:


The only error is that references to "null_ok" should be "allow_null". 
At least that's the way I got it to work.

Anthony Foglia
Princeton Consultants
(609) 987-8787 x233

More information about the Cplusplus-sig mailing list