summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
authorDavid Powell <david.a.powell@anu.edu.au>2015-03-06 18:45:12 +1100
committerDavid Powell <david.a.powell@anu.edu.au>2015-03-06 18:55:17 +1100
commitdf6b31d535c1d388a2022f24c228e02547f89310 (patch)
treeaec6be4d15e973a5dc4a8a02a5aba84be96798cf /numpy/f2py
parent4cba5310c7b8d1a3aab7202209d238f569a8f9ff (diff)
downloadnumpy-df6b31d535c1d388a2022f24c228e02547f89310.tar.gz
BUG: Cannot read .f2py_f2cmaps under python 3.3
When reading .f2py_f2cmaps, these is iteration over dictionaries keys() and items(), which are iterators in python 3. This prohibits modifying the dicionaries while iterating. By wrapping these calls with list(), the python 2 behaviour is restored. Fixes #5637.
Diffstat (limited to 'numpy/f2py')
-rw-r--r--numpy/f2py/capi_maps.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/f2py/capi_maps.py b/numpy/f2py/capi_maps.py
index 536a576dd..6155165ba 100644
--- a/numpy/f2py/capi_maps.py
+++ b/numpy/f2py/capi_maps.py
@@ -178,14 +178,14 @@ if os.path.isfile('.f2py_f2cmap'):
f = open('.f2py_f2cmap', 'r')
d = eval(f.read(), {}, {})
f.close()
- for k, d1 in d.items():
- for k1 in d1.keys():
+ for k, d1 in list(d.items()):
+ for k1 in list(d1.keys()):
d1[k1.lower()] = d1[k1]
d[k.lower()] = d[k]
- for k in d.keys():
+ for k in list(d.keys()):
if k not in f2cmap_all:
f2cmap_all[k]={}
- for k1 in d[k].keys():
+ for k1 in list(d[k].keys()):
if d[k][k1] in c2py_map:
if k1 in f2cmap_all[k]:
outmess("\tWarning: redefinition of {'%s':{'%s':'%s'->'%s'}}\n"%(k, k1, f2cmap_all[k][k1], d[k][k1]))