When creating an object from a PyObject *, how do you distinguish
between a PyObject pointer that is a new reference (must not be
increfed, but must be decrefed) versus a PyObject * that is a borrowed
reference? (should be increfed and decrefed)

A very simple question for which there is no documented answer,
conflicting answers in the archives of this mailing list, and hours of
googling has turned up conflicting information.

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.

Please someone put me out of my misery. What's the interface for this?

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

Reply via email to