summaryrefslogtreecommitdiff
path: root/numpy/distutils/command
diff options
context:
space:
mode:
authorNicholas McKibben <nicholas.bgp@gmail.com>2021-02-04 12:13:39 -0700
committerGitHub <noreply@github.com>2021-02-04 12:13:39 -0700
commitd3763198673ffc1092539041b8bd23134ae22bee (patch)
treea087696c1e4c64b23b0fcc70d2abad3078dfee37 /numpy/distutils/command
parent9f12028b9453c17b72b26355fd503e512af96a5d (diff)
downloadnumpy-d3763198673ffc1092539041b8bd23134ae22bee.tar.gz
BUG: don't mutate list of fake libraries while iterating over it (#18295)
* BUG: don't mutate list of fake libraries while iterating over it * BUG: iterate over copy of list * TST: add build test for build_ext fix (#1) * TST: add build test for build_ext fix * TST: clearer test name * STY: use triple quotes instead of lists of strings * FIX: check for f77 compiler before test is run * DOC: add comment explaining that a list copy is necessary
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r--numpy/distutils/command/build_ext.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py
index 448f7941c..99c6be873 100644
--- a/numpy/distutils/command/build_ext.py
+++ b/numpy/distutils/command/build_ext.py
@@ -569,8 +569,11 @@ class build_ext (old_build_ext):
objects = list(objects)
unlinkable_fobjects = list(unlinkable_fobjects)
- # Expand possible fake static libraries to objects
- for lib in libraries:
+ # Expand possible fake static libraries to objects;
+ # make sure to iterate over a copy of the list as
+ # "fake" libraries will be removed as they are
+ # enountered
+ for lib in libraries[:]:
for libdir in library_dirs:
fake_lib = os.path.join(libdir, lib + '.fobjects')
if os.path.isfile(fake_lib):