In this case the Pyobject gets lost from pybm, and bm.free() does not invalidate the PyElem. This will cause the destructor of python to read invalid memory and crash. The solution is to make a copy of the pyobjects pointers before overwriting.
In this case the Pyobject gets lost from pybm, and bm.free() does not invalidate the PyElem. This will cause the destructor of python to read invalid memory and crash. The solution is to make a copy of the pyobjects pointers before overwriting.