[C++-sig] set python attribute from C++

Gennadiy Rozental rogeeff at gmail.com
Thu Jul 17 17:28:45 CEST 2008


Hans Meine <meine <at> informatik.uni-hamburg.de> writes:
> AFAIK, this is what SIP does, since Qt also manages the lifetime itself.  
> However, that means that you have to check in every operation whether the 
> underlying C++ object has been deleted (and throw a corresponding Python 
> exception).

How can I do this?

> Alternatively, you risk crashes and call that usage errors.  
> (Depending on the actual object lifetimes, this may be practically feasible.)

I am calling incref on python object when it was constructed and calling decref
in C++ object destructor. It seems decref should cause python object ot be
immediately destroyed. Do u believe it'll be safe in this environment?





More information about the Cplusplus-sig mailing list