Embedded python debug build crashing.
adamtj at adamtj.org
Sun Aug 28 00:45:44 CEST 2005
I'm trying to embed Python 2.3.5 into a C++ application on Windows XP.
When I build my app with debug symbols and link to a debug build of
Python, then my program seems to crash most (but not all) of the time.
Sometimes it crashes on startup, and sometimes at exit, sometimes not at
all. I haven't seen it crash with non-debug builds of my app and
Python. The release build runs my Python test code just fine. When the
debug build doesn't crash at startup, it gets through some, but not all
of my test code. It still crashes even if I only run Py_Intialize() and
Py_Finalize(). My app is multithreaded, but Python only runs in the
I use Visual Studio .NET 2003 7.1. If I understand things correctly,
that means I need to recompile Python, since the prebuilt binaries are
compiled with MSVC 6. I've compiled both debug and non-debug versions
of Python. I'm sure that I'm linking my app to the correct build type.
I'm also pretty sure that I'm setting the PYTHONHOME environment
variable correctly so that my app is trying to use the right Python
runtime. Windows has a trick where, if my app's executable is called
app.exe, then the presence of a file called app.exe.local in the same
directory will force my app to use local copies of DLLs first. I've
used that, so I'm pretty sure I'm not accidentally using the wrong DLLs
I've googled and couldn't find any similar problems. Is there something
simple I'm forgetting to do? I'm out of ideas. Does anybody have any
ideas about how to attack this problem?
More information about the Python-list