The best I could find was object(borrowed(ptr)) for new references and
object(handle<>(ptr)) for borrowed pointers. I'm not sure if that is
accurate, but if so that deserves a nomination for a terrible
interface award.

The documentation isn't great, but the name 'borrowed' is a hint. Using borrowed instructs boost.python that the PyObject * is a borrowed reference. So you can use:

object(handle<>(borrowed(ptr)))

for when ptr is a borrowed reference and

object(handle<>(ptr))

for when ptr is a new reference.

Alex

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to