[New-bugs-announce] [issue3741] DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an exception

Paul "TBBle" Hampson report at bugs.python.org
Sun Aug 31 19:14:49 CEST 2008


New submission from Paul "TBBle" Hampson <Paul.Hampson at Pobox.com>:

Basically, if DISTUTILS_USE_SDK is set in the environment and an
extension is attempted to be built from within the Windows SDK shell
(ie. MSSdk is set in the environment as well), msvc9compiler.py will
raise an exception due to a reference to the undefined self.__paths in
MSVCCompiler.find_exe class, called from MSVCCompiler.initialize.

self.__paths is used both in MSVCCompiler.find_exe and further through
MSVCCompiler.initialize, but only exists if the else branch of the
DISTUTILS_USE_SDK if/else is taken.

I've attached a patch which trivially fixes this by setting self.__paths
to [] before the test for DISTUTILS_USE_SDK.

However, the use of MSVCCompiler.find_exe in this test might be wrong.
Short of raising an exception, MSVCCompiler.find_exe always returns what
it is supplied if it can't find anything better. So testing the truth of
this value is likely incorrect. (I assume that find_exe used to return a
false value if the requested program could not be found on the path or
in self.__paths[]...)

If the find_exe is removed from the test, then the setting of
self.__paths can be done inside the if branch, paralleling the else branch.

----------
components: Distutils
files: msvc9compiler-windowssdk.diff
keywords: patch
messages: 72209
nosy: TBBle
severity: normal
status: open
title: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an exception
versions: Python 2.6
Added file: http://bugs.python.org/file11318/msvc9compiler-windowssdk.diff

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


More information about the New-bugs-announce mailing list