Re: [C++-sig] Memory management in Boost.Python

2015-04-02 Thread Ernie Lee
Also, i found that i manually call 'Py_XINCREF' on callback object (ie on 'a1' in this example) then script is terminating without errors and do not see destructor call for a1 object (but i guess later one is expected). Thoughts? On Sun, Mar 15, 2015 at 6:11 PM, Ernie Lee

Re: [C++-sig] Subclassing C++ classes in Python

2015-03-16 Thread Ernie Lee
Hi Holger, Adding checks for override and default implementation fixed the issue. - Thank you! Best, Ernie. On Mon, Mar 16, 2015 at 2:04 AM, Holger Joukl wrote: > > Hi Ernie, > > > When I tries to use class exposed as ’wrapper’ as substitute for C > > ++ original class i am getting a se

[C++-sig] Subclassing C++ classes in Python

2015-03-15 Thread Ernie Lee
Hi there, I am creating binding for some C++ classes and I need to be able to subclass exposed C++ classes in Python (and pass subclassed instances back in to C++ code). I was able to make this work by following this example: http://www.boost.org/doc/libs/1_57_0/libs/python/doc/tutorial/doc/h

Re: [C++-sig] Memory management in Boost.Python

2015-03-15 Thread Ernie Lee
boost::python::def("reset_callback", reset_callback); boost::python::def("test_callback", test_callback); } On Wed, Mar 11, 2015 at 12:01 AM, Stefan Seefeld wrote: > On 10/03/15 11:24 PM, Ernie Lee wrote: > > Hi Stefan, > > > > I update

Re: [C++-sig] Memory management in Boost.Python

2015-03-10 Thread Ernie Lee
s tries to manage memory directly, disregarding SP layer? Thanks, Ernie. On Tue, Mar 10, 2015 at 3:55 PM, Ernie Lee wrote: > Thank you for looking this up Stefan! It turned out that we actually > using boost::shared_ptr but in rather non-straight-forward way: it got pull > in to our

Re: [C++-sig] Memory management in Boost.Python

2015-03-10 Thread Ernie Lee
Thank you for looking this up Stefan! It turned out that we actually using boost::shared_ptr but in rather non-straight-forward way: it got pull in to our own namespace so in the end Boost::Python::class_ is 'called' with held-type set to a formally different type name. I will see if setting held

[C++-sig] Memory management in Boost.Python

2015-03-10 Thread Ernie Lee
Hello, I am working on adding Python binding to C++ project and run into the following problem: For some reason Python tries to delete objects that are still held by smart pointer instances in our C++ code. We are using std::shared_ptr for memory management and classes exposed through Boost::