On 02/25/2012 09:25 AM, Adam Preble wrote:
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<tallji...@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
it.
It's - probably unfortunately - just a totally non-standard accessor:
".ptr()".
But you're basically right - there's really no need to worry about
managing the pointer lifetime in this case, so PyObject * is just fine.
Jim
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig