[Boost-bugs] [Boost C++ Libraries] #2794: boost::python::handle constructor problem

Subject: [Boost-bugs] [Boost C++ Libraries] #2794: boost::python::handle constructor problem
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-23 05:05:35


#2794: boost::python::handle constructor problem
------------------------------------------+---------------------------------
 Reporter: Rick Yang <rick68_at_[hidden]> | Owner: dave
     Type: Patches | Status: new
Milestone: Boost 1.39.0 | Component: Python
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
------------------------------------------+---------------------------------
 Hi,

 I tried my test code:
 {{{
 #include <iostream>

 #include <boost/cstdlib.hpp>

 #include <boost/python/refcount.hpp>
 #include <boost/python/handle.hpp>

 int main(void)
 {
     using boost::python::allow_null;
     using boost::python::handle;

     Py_Initialize();

     PyObject* py_int = PyInt_FromLong(68);

     std::cout << "py_int->ob_refcnt = ["
         << py_int->ob_refcnt << ']' << std::endl;


     {
         handle<PyObject> h1(allow_null(py_int));
         handle<PyObject> h2(py_int);
     }
     std::cout << "py_int->ob_refcnt = ["
         << py_int->ob_refcnt << ']' << std::endl;

     boost::python::decref(py_int);
     Py_Finalize();


     return boost::exit_success;
 }
 }}}

 and this is my result:
 {{{
 py_int->ob_refcnt = [9]
 py_int->ob_refcnt = [7]
 }}}

 the reference counter not keep to1 9.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2794>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC