[issue4214] no extension debug info with msvc9compiler.py

Robin Dunn report at bugs.python.org
Mon Nov 29 20:53:09 CET 2010


Robin Dunn <robin at alldunn.com> added the comment:

No, MSVC does not behave that way any longer.  Now it simply creates a file named "None", so I expect that the newer versions simply do not support writing the "old-style" debug info written to the DLL or EXE. If a setup script creates more than one extension module then they all overwrite that None file.

In order to get debug info in a useable form, distutils simply can not use /pdb:None.  By removing that option entirely then debug info is generated like normal into a *.pdb file and using the debugger to trace through the extension module's code will happily work correctly.

I've had to have this hack in wxPython's setup.py since Python 2.6 to work around this problem:


# Yet another distutils hack, this time for the msvc9compiler.  There
# is a bug in at least version distributed with Python 2.6 where it
# adds '/pdb:None' to the linker command-line, but that just results
# in a 'None' file being created instead of putting the debug info
# into the .pyd files as expected.  So we'll strip out that option via
# a monkey-patch of the msvc9compiler.MSVCCompiler.initialize method.

if os.name == 'nt' and  sys.version_info >= (2,6):
    import distutils.msvc9compiler
    _orig_initialize = distutils.msvc9compiler.MSVCCompiler.initialize

    def _initialize(self, *args, **kw):
        rv = _orig_initialize(self, *args, **kw)
        try:
            self.ldflags_shared_debug.remove('/pdb:None')
        except ValueError:
            pass
        return rv

    distutils.msvc9compiler.MSVCCompiler.initialize = _initialize

----------
versions: +Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4214>
_______________________________________


More information about the Python-bugs-list mailing list