[Cython] Windows Debug build improvement

Nikita Nemkin nikita at nemkin.ru
Wed Jul 24 17:15:49 CEST 2013


On Thu, 18 Jul 2013 19:24:21 +0600, Wolfgang <tds333 at gmail.com> wrote:

> Hi,
>
> I tried to submit a improvement for the Windows build but the tracker is  
> not
> accessible without a login.
>
> 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 debug my extensions on Windows (in Visual Studio), I just add
the appropriate compiler flags:

extension = Extension(
     ...
     extra_compile_args=['/Zi', '/Od'],  # generate PDB, disable  
optimization
     extra_link_args=['/DEBUG'])         # preserve debug info

Add to that symbol files for the Python release you are using
("program database" links on this page  
http://www.python.org/getit/releases/2.7.5/)
and you will have a comfortable debugging environment.


Best regards,
Nikita Nemkin


More information about the cython-devel mailing list