[C++-sig] Crash (segfault) on del(x.__dict__) where x is a boost.python wrapped instance.

Alex Mohr amohr at pixar.com
Thu Jul 31 19:09:55 CEST 2008


Tested with boost 1.34 on x86-64 linux, gcc 4.1.2.  I have attached a 
very small example below.

I know that del(x.__dict__) is a rather odd thing to try to do, and we 
stumbled upon this by accident.  It is not a big deal for us.  That 
said, it might be nice to fix if it's easy.

Thanks,

Alex


////////////////////////////////////////////////////////////////////////
// C++

#include <boost/python/class.hpp>

class X {};

BOOST_PYTHON_MODULE(del_dict_segfault) {
     boost::python::class_<X>("X");
}


########################################################################
## Python

 >>> from del_dict_segfault import X
 >>> x = X()
 >>> del(x.__dict__) # this segfaults.



More information about the Cplusplus-sig mailing list