diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py index a4f49b00eaa2..e1f15d465e7b 100644 --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -132,12 +132,12 @@ def run(self): log.info("Detected changes on compiler optimizations, force rebuilding") self.force = True - import atexit - def report(): + def report(copt): log.info("\n########### CLIB COMPILER OPTIMIZATION ###########") - log.info(self.compiler_opt.report(full=True)) + log.info(copt.report(full=True)) - atexit.register(report) + import atexit + atexit.register(report, self.compiler_opt) if self.have_f_sources(): from numpy.distutils.fcompiler import new_fcompiler diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index 91cb0d897021..ca29ad4c0c19 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -160,11 +160,12 @@ def run(self): log.info("Detected changes on compiler optimizations, force rebuilding") self.force = True - import atexit - def report(): + def report(copt): log.info("\n########### EXT COMPILER OPTIMIZATION ###########") - log.info(self.compiler_opt.report(full=True)) - atexit.register(report) + log.info(copt.report(full=True)) + + import atexit + atexit.register(report, self.compiler_opt) # Setup directory for storing generated extra DLL files on Windows self.extra_dll_dir = os.path.join(self.build_temp, '.libs')