On Thu, Jul 18, 2013 at 6:24 AM, Wolfgang <tds333@gmail.com> wrote:
Hi,
I tried to submit a improvement for the Windows build but the tracker is not accessible without a login.
This is to prevent spam.
On Windows if someone does a Debug build of an extension the flag _DEBUG is set and so the Python Interpreter sets Py_DEBUG and for all extension modules "_d" is appended to load the debug version of a module. This is not really practical because then all modules and the Python Interpreter must be build in Debug mode. For some modules this is even not possible for Windows. :-(
To do a debug build for a Cython generated extension with a normal Python Interpreter (none Debug) I have to patch the pyconfig.h file and undef _DEBUG or I must patch the generated c file from Cython to undef _DEBUG before pyconfig.h or Python.h is included. (and enable it afterwards)
Is it possible to add a flag to Cython to generate code that does this ?
Something like described in Boost.Python: http://hepunx.rl.ac.uk/BFROOT/dist/releases/26.0.0/boost/libs/python/doc/bui...
It is enough to have a new Preprocessor Flag, if set, then surround the Python.h inclusion with a disabled _DEBUG.
My workarround is to disable it before pyconfig.h (Python.h) include:
#ifdef _DEBUG #undef _DEBUG #define _RESTORE #endif
and enable it afterwards
#ifdef _RESTORE #define _DEBUG #undef _RESTORE #endif
Seems like a fairly global change. At the very least it should be guarded with an #if [windows/msvc/?], and _RESTORE probably named __PYX_RESTORE_DEBUG or something less likely to clash. But it'd be really helpful for someone who uses and knows windows well to comment on the possible implications of this, as I don't even have a way to try it out.