diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index 36a62eb1a06f..8b568c1596de 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -393,8 +393,8 @@ def build_extension(self, ext): log.info("building '%s' extension", ext.name) extra_args = ext.extra_compile_args or [] - extra_cflags = ext.extra_c_compile_args or [] - extra_cxxflags = ext.extra_cxx_compile_args or [] + extra_cflags = getattr(ext, 'extra_c_compile_args', None) or [] + extra_cxxflags = getattr(ext, 'extra_cxx_compile_args', None) or [] macros = ext.define_macros[:] for undef in ext.undef_macros: