[Numpy-discussion] numpy.distutils bug, fix, comments?

Robert Kern robert.kern@gmail....
Sat Mar 8 16:35:00 CST 2008


On Sat, Mar 8, 2008 at 4:10 PM, Matthew Brett <matthew.brett@gmail.com> wrote:
> Hi,
>
>  I think I found a bug in numpy/distutils/ccompiler.py - and wanted to
>  check that no-one has any objections before I fix it.
>
>  These lines (390ff distutils.ccompiler.py)
>
>   for _cc in ['msvc', 'bcpp', 'cygwinc', 'emxc', 'unixc']:
>      _m = sys.modules.get('distutils.'+_cc+'compiler')
>      if _m is not None:
>         setattr(getattr(_m, _cc+'compiler'), 'gen_lib_options',
>                 gen_lib_options)
>
>  occasionally cause an error with message of form module has no
>  attribute 'unixccompiler'.
>
>  As far as I can see, the line beginning '_m' can only return None, or,
>  in my case, the
>   distutils.unixccompiler module.  Then the getattr phrase will request
>   an attribute 'unixccompiler' from the distutils.unixccompiler module,
>  causing an error.
>
>  I'm suggesting changing the relevant line to:
>
>         setattr(_m, 'gen_lib_options',
>
>  Any objections?  If not I'll commit soon...

I believe you are correct.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list