Index: libs/python/doc/tutorial/doc/tutorial.qbk =================================================================== --- libs/python/doc/tutorial/doc/tutorial.qbk (revision 76153) +++ libs/python/doc/tutorial/doc/tutorial.qbk (working copy) @@ -1302,6 +1302,22 @@ [def PyModule_GetDict [@http://www.python.org/doc/current/api/moduleObjects.html#l2h-594 PyModule_GetDict]] [endsect] + +[section Creating boost::python::object from PyObject*] + +When you want a boost::python::object to manage a pointer to PyObject* pyobj one does: + + boost::python::object o(boost::python::handle<>(pyobj)); + +In this case, the o object, manages the pyobj, it won’t increase the reference count on construction. + +Otherwise, to use a borrowed reference: + + boost::python::object o(boost::python::handle<>(boost::python::borrowed(pyobj))); + +In this case, Py_INCREF is called, so pyobj is not destructed when object o goes out of scope. +[endsect] + [endsect] [/ Object Interface] [section Embedding]