Skip to content

Commit

Permalink
MAINT: avoid modifying mutable default values
Browse files Browse the repository at this point in the history
  • Loading branch information
ceh committed Sep 29, 2018
1 parent a000144 commit 2b7c1d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions numpy/distutils/command/config_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

#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
Expand Down
4 changes: 3 additions & 1 deletion numpy/distutils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2b7c1d3

Please sign in to comment.