[C++-sig] Wrapping a function that takes class type, such as type_info

Adam Preble adam.preble at gmail.com
Sat Feb 25 15:25:13 CET 2012

It looks like PyObject_IsSubClass is working (!), but I wanted to follow up
on the boost::python::object stuff:

On Fri, Feb 24, 2012 at 9:56 PM, Jim Bosch <talljimbo at gmail.com> wrote:

> On 02/24/2012 02:31 AM, Adam Preble wrote:
>> Jim,
>> I'll top post since I think this might get messy nice and fast
>> otherwise.  I found I couldn't get to a method wrapped to type a
>> PyTypeObject* and only PyObject* would do.
> Yeah, that's not surprising.  You can also have it take a
> boost::python::object; that's essentially a smart pointer for PyObject*.

I couldn't get that to work.  I can't pass it directly into
PyObject_IsSubclass, which isn't surprising.  However, I couldn't do a get
or find anything else to extract the PyObject* out of it.  Is there a trick
to this?  I would wonder--is there a particular reason I should use that
instead?  In my case, I'm not trying to sit on the pointer outside of the
class to Has().  The list I'm using has shared_ptr's of the underlying type
already.  So I assume in my particular case I wouldn't have to worry about

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20120225/b7e87ea9/attachment.html>

More information about the Cplusplus-sig mailing list