[C++-sig] c++ object deleted

Stefan Seefeld seefeld at sympatico.ca
Wed Nov 12 18:14:16 CET 2008


Renato Araujo wrote:
> Hi all,
>
> Is possible in boost::python create a exception when the c++ object is
> deleted internal, and you try use the python object. Because here I
> got a core when I try do this.
>   

I'm not sure whether it's technically possible, but I do believe this is 
a bad idea: Exceptions are just the wrong tool to deal with programming 
errors. Instead, you need to figure out what the expected lifetime of 
your object is and why it got deleted before. Once you understand this, 
modify your boost.python wrappers to use the appropriate return-value 
(or call) policies so this doesn't happen again.

Regards,
       Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list