diff options
-rw-r--r-- | numpy/core/_internal.py | 3 | ||||
-rwxr-xr-x | numpy/f2py/crackfortran.py | 11 | ||||
-rw-r--r-- | numpy/f2py/f90mod_rules.py | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py index 105b5d24a..f8de6dd09 100644 --- a/numpy/core/_internal.py +++ b/numpy/core/_internal.py @@ -4,6 +4,7 @@ A place for internal code Some things are more easily handled Python. """ +import ast import re import sys import platform @@ -196,7 +197,7 @@ def _commastring(astr): if (repeats == ''): newitem = dtype else: - newitem = (dtype, eval(repeats)) + newitem = (dtype, ast.literal_eval(repeats)) result.append(newitem) return result diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index 910120e00..09bab11bd 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -3113,11 +3113,12 @@ def true_intent_list(var): ret = [] for intent in lst: try: - c = eval('isintent_%s(var)' % intent) - except NameError: - c = 0 - if c: - ret.append(intent) + f = globals()['isintent_%s' % intent] + except KeyError: + pass + else: + if f(var): + ret.append(intent) return ret diff --git a/numpy/f2py/f90mod_rules.py b/numpy/f2py/f90mod_rules.py index ad96591c0..f4f1bf1a9 100644 --- a/numpy/f2py/f90mod_rules.py +++ b/numpy/f2py/f90mod_rules.py @@ -178,7 +178,7 @@ def buildhooks(pymod): (m['name'], undo_rmbadname1(n))) fadd('integer flag\n') fhooks[0] = fhooks[0] + fgetdims1 - dms = eval('range(1,%s+1)' % (dm['rank'])) + dms = range(1, int(dm['rank']) + 1) fadd(' allocate(d(%s))\n' % (','.join(['s(%s)' % i for i in dms]))) fhooks[0] = fhooks[0] + use_fgetdims2 |