diff options
author | Emil Hessman <emil@hessman.se> | 2018-09-29 21:25:55 +0200 |
---|---|---|
committer | Emil Hessman <emil@hessman.se> | 2018-09-29 21:25:55 +0200 |
commit | 2b7c1d33132bc80da25a6b2a3eae65dd1a1ff284 (patch) | |
tree | 1a4ff1f88b0fc3804373d1f13853d930a17d1f14 | |
parent | a000144dfa44b38e1681ea5498d88ed6eda9876a (diff) | |
download | numpy-2b7c1d33132bc80da25a6b2a3eae65dd1a1ff284.tar.gz |
MAINT: avoid modifying mutable default values
-rw-r--r-- | numpy/distutils/command/config_compiler.py | 9 | ||||
-rw-r--r-- | numpy/distutils/core.py | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/numpy/distutils/command/config_compiler.py b/numpy/distutils/command/config_compiler.py index 5e638fecc..bf170063e 100644 --- a/numpy/distutils/command/config_compiler.py +++ b/numpy/distutils/command/config_compiler.py @@ -5,9 +5,12 @@ from numpy.distutils import log #XXX: Linker flags -def show_fortran_compilers(_cache=[]): - # Using cache to prevent infinite recursion - if _cache: return +def show_fortran_compilers(_cache=None): + # Using cache to prevent infinite recursion. + if _cache: + return + elif _cache is None: + _cache = [] _cache.append(1) from numpy.distutils.fcompiler import show_fcompilers import distutils.core diff --git a/numpy/distutils/core.py b/numpy/distutils/core.py index d9e125368..70cc37caa 100644 --- a/numpy/distutils/core.py +++ b/numpy/distutils/core.py @@ -71,12 +71,14 @@ def _dict_append(d, **kws): else: raise TypeError(repr(type(dv))) -def _command_line_ok(_cache=[]): +def _command_line_ok(_cache=None): """ Return True if command line does not contain any help or display requests. """ if _cache: return _cache[0] + elif _cache is None: + _cache = [] ok = True display_opts = ['--'+n for n in Distribution.display_option_names] for o in Distribution.display_options: |