Closed stephengtuggy closed 1 year ago
@stephengtuggy you might need to add
target_compile_definitions(${target_name} PUBLIC "$<$<CONFIG:Debug>:BOOST_DEBUG_PYTHON>")
target_compile_definitions(${target_name} PUBLIC "$<$<CONFIG:Debug>:Py_DEBUG>")
to your CMakeLists.txt
.
@stephengtuggy you might need to add
target_compile_definitions(${target_name} PUBLIC "$<$<CONFIG:Debug>:BOOST_DEBUG_PYTHON>") target_compile_definitions(${target_name} PUBLIC "$<$<CONFIG:Debug>:Py_DEBUG>")
to your
CMakeLists.txt
.
@Osyotr Hmm. Interesting. When I make those changes, I am no longer able to reproduce the crash. At least not as reliably.
Any idea what makes the difference?
I see. I had BOOST_DEBUG_PYTHON
in place, but not Py_DEBUG
. Also, I was setting the compile definitions on the directory level, not per-target. Not sure if the latter makes a significant difference or not.
Closing, since @Osyotr 's solution worked. Thanks!
As reported here:
Running
boost::python::import("__main__");
crashes on Windows, specifically when compiled in Debug configuration (not Release). This was on Windows 11 x64, with Python 3.10, I believe. Others have reported the same issue with other versions of Windows and of Python. This issue does not exist on Linux, as far as I can tell.A small program illustrating this bug can be found here.
Thanks.