--- /opt/Python-2.7a2/lib/python2.7/distutils/command/build_ext.py.orig 2010-01-13 11:28:14.413268745 -0500 +++ /opt/Python-2.7a2/lib/python2.7/distutils/command/build_ext.py 2010-01-13 11:40:21.125305264 -0500 @@ -127,16 +127,18 @@ # need this to make sure setattr() (used in distutils) # doesn't kill our property if name == 'compiler': - self._set_compiler(value) + self._set_compiler(value, 3) # extra frame for warning else: self.__dict__[name] = value - def _set_compiler(self, compiler): + def _set_compiler(self, compiler, _stacklevel=2): + # stacklevel variable to allow __setattr__ to bump it. if not isinstance(compiler, str) and compiler is not None: # we don't want to allow that anymore in the future warn("'compiler' specifies the compiler type in build_ext. " "If you want to get the compiler object itself, " - "use 'compiler_obj'", DeprecationWarning) + "use 'compiler_obj'", DeprecationWarning, + stacklevel=_stacklevel) self._compiler = compiler def _get_compiler(self): @@ -144,7 +146,8 @@ # we don't want to allow that anymore in the future warn("'compiler' specifies the compiler type in build_ext. " "If you want to get the compiler object itself, " - "use 'compiler_obj'", DeprecationWarning) + "use 'compiler_obj'", DeprecationWarning, + stacklevel=2) return self._compiler compiler = property(_get_compiler, _set_compiler)