Re: [C++-sig] GIL problems during destruction of a boost::python::wrapper

2012-05-07 Thread Jim Bosch
On 05/07/2012 11:30 AM, Adam Preble wrote: I want to make sure I understand the repercussions. I understand if I were introducing C++ objects into the Python runtime as internal references that I would be inviting disaster if I delete them on the C++ side, but continue to use them on the Python

Re: [C++-sig] GIL problems during destruction of a boost::python::wrapper

2012-05-07 Thread Niall Douglas
On 7 May 2012 at 10:30, Adam Preble wrote: > I want to make sure I understand the repercussions. > > I understand if I were introducing C++ objects into the Python runtime as > internal references that I would be inviting disaster if I delete them on > the C++ side, but continue to use them on th

Re: [C++-sig] GIL problems during destruction of a boost::python::wrapper

2012-05-07 Thread Adam Preble
I want to make sure I understand the repercussions. I understand if I were introducing C++ objects into the Python runtime as internal references that I would be inviting disaster if I delete them on the C++ side, but continue to use them on the Python side. I don't think either of us were talkin

Re: [C++-sig] GIL problems during destruction of a boost::python::wrapper

2012-05-07 Thread Niall Douglas
Only Python may delete a python managed object. You cannot destroy any python object explicitly from the C++ side of things. Solution: allow the python wrapper and C++ instance being wrapped to detach from one another. That way if the C++ object is deleted, you zombify the python representation

[C++-sig] GIL problems during destruction of a boost::python::wrapper

2012-05-06 Thread Adam Preble
I'm running into my old friend the GIL when it comes time to destroy an object I've wrapped using boost::python::wrapper. The object is being bandied around as a shared pointer, and it's refcount is ending at the time I want. Unfortunately, I get the old "PyThreadState_Get: no current thread" err