[C++-sig] Boost.Python app keeps crashing in debug

Martin Walser NurEinDummy at gmx.de
Thu Feb 19 15:05:43 CET 2009

Hi! :)

I'm on the best way to become completely insane.

I'm trying to set up VS2005 to run Boost Python in debug mode.

Sorry for the long text...

Problem summary:

- applications crash in debug mode
- dependencies to python25_d.dll AND python25.dll in
boost_python-vc80-mt-gdy-1_35.dll - normal??

Only today I found out that I have to pass a special parameter to REALLY get
a debug version.

So I went into .\boost_1_35_0\libs\python\example\quickstart
and called bjam with:

bjam toolset=msvc --verbose-test test python-debugging=on

Finally I got my boost_python-vc80-mt-gdy-1_35.dll & .lib files.

Yet, simply defining BOOST_DEBUG_PYTHON & BOOST_ALL_NO_LIB in the header
didn't work out.
Had to put them in the preprocessor to make VC8 use the ...-gdy-... lib
instead of the ...-gd-... lib. 
And to make him stop importing Python25.lib instead of python25_d.lib when
building my .pyd C extension.

Finally I found out that I have to add a _d to my extension filename as well
so that python_d.exe finds the class I want to import.

But now... my application crashes right after starting.
Even the HelloWorld application from the tutorial crashes instantly:

Unhandled exception at ... in python_d.exe

And the debugger points to boost_1_35_0\libs\python\src\object\class.cpp's:


  BOOST_PYTHON_DECL type_handle class_type()
      if (class_type_object.tp_dict == 0)
          class_type_object.ob_type = incref(class_metatype().get());
          class_type_object.tp_base = &PyBaseObject_Type;
=>!!!     if (PyType_Ready(&class_type_object))
              return type_handle();
//          class_type_object.tp_setattro = class_setattro;
      return type_handle(borrowed(&class_type_object));


Additionally, when putting boost_python-vc80-mt-gdy-1_35.dll in dependency
walker I find dependencies to python25_d.dll AND python25.dll in it.
I temporarily deleted python25.lib for testing ... and indeed, bjam demands
python25.lib when building.

Screenshot: http://i41.tinypic.com/2551g5j.jpg

I hope someone with more experience got a clue...
I'm lost. :(



More information about the Cplusplus-sig mailing list