[C++-sig] SIGSEGV on extract_pointer

Itamar Shtull-Trauring itamar at itamarst.org
Thu Sep 30 23:36:16 CEST 2004


Platform: Redhat 7.3 on x86, gcc 2.96 (yes, it's horrible and ancient),
boost 1.31.

I have some code that looks like this:

    extract<Twisted::DatagramProtocol*> pchecker(self.attr("protocol"));
    if (pchecker.check()) {
	this->protocol = pchecker();

When running this it gets a SIGSEGV:

0x401eccb5 in boost::python::converter::get_lvalue_from_python () from
/usr/local/lib/libboost_python-gcc-mt-1_31.so.1.31.0
(gdb) up
#1  0x4027bcf2 in
boost::python::converter::extract_pointer<Twisted::DatagramProtocol
*>::extract_pointer (this=0xbfffda68, obj=0x87666ac)
    at /usr/local/include/boost-1_31/boost/python/extract.hpp:203

The code in question being:

  template <class Ptr>
  inline extract_pointer<Ptr>::extract_pointer(PyObject* obj)
      : m_source(obj)
      , m_result(
          obj == Py_None ? 0 : (get_lvalue_from_python)(obj,
registered_pointee<Ptr>::converters)
          )
  {
  }

Here's the fun part - it does NOT crash when I compile with -fno-inline.
My code is perfectly valid, AFAICT - there is a protocol attribute there
and it is of the right type.

This is part of my C++/Twisted integration project.

-- 
Itamar Shtull-Trauring    http://itamarst.org





More information about the Cplusplus-sig mailing list