[C++-sig] how to correctly delete stuff 'extract<>'ed from python?

Kleistereimer kleistereimer at gmx.de
Thu Jul 6 15:06:17 CEST 2006


hi!

how to correctly delete stuff  'extract<>'ed  from python?
i have:

 python::object somepyobj = ...
 Tobj *obj = python::extract<Tobj*>(somepyobj);

 obj->DoStuff(..);


but the following line fails in debugmode:

 delete obj;


because of it was allocated from another heap. errormsg is:
  _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
  in dbgdel.cpp(52)


in releasemode everything is fine. (i think this problem is silently
ignored then)


i guess i have to replace


 delete obj;
by something like:
 python::delete_(obj);

???

i use msvc 7.1 and boost 1.33.1


regards
kl



More information about the Cplusplus-sig mailing list