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

Matthew Brett matthew.brett@gmail....
Sat Mar 8 16:10:59 CST 2008


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...

Matthew


More information about the Numpy-discussion mailing list