Boost C++ Libraries: Ticket #2794: boost::python::handle constructor problem https://svn.boost.org/trac10/ticket/2794 <p> Hi, </p> <p> I tried my test code: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/cstdlib.hpp&gt; #include &lt;boost/python/refcount.hpp&gt; #include &lt;boost/python/handle.hpp&gt; int main(void) { using boost::python::allow_null; using boost::python::handle; Py_Initialize(); PyObject* py_int = PyInt_FromLong(68); std::cout &lt;&lt; "py_int-&gt;ob_refcnt = [" &lt;&lt; py_int-&gt;ob_refcnt &lt;&lt; ']' &lt;&lt; std::endl; { handle&lt;PyObject&gt; h1(allow_null(py_int)); handle&lt;PyObject&gt; h2(py_int); } std::cout &lt;&lt; "py_int-&gt;ob_refcnt = [" &lt;&lt; py_int-&gt;ob_refcnt &lt;&lt; ']' &lt;&lt; std::endl; boost::python::decref(py_int); Py_Finalize(); return boost::exit_success; } </pre><p> and this is my result: </p> <pre class="wiki">py_int-&gt;ob_refcnt = [9] py_int-&gt;ob_refcnt = [7] </pre><p> the reference counter not keep to1 9. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2794 Trac 1.4.3 Rick Yang <rick68@…> Fri, 06 Mar 2009 20:05:11 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2794#comment:1 https://svn.boost.org/trac10/ticket/2794#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket