diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-01-05 21:43:01 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2020-01-11 19:57:12 +0000 |
commit | c8bdb9c7f91d12f20a3c6a27d776e2bc4a916d81 (patch) | |
tree | 963345e397c00ef098cf73abc3c6c7c8b3f6fda6 /numpy/f2py/f90mod_rules.py | |
parent | c9fd0e7c1e077d3044b4f2cd419b89c8bf0544c7 (diff) | |
download | numpy-c8bdb9c7f91d12f20a3c6a27d776e2bc4a916d81.tar.gz |
MAINT: Eliminate some calls to `eval`
* The instance in `_internal` is parsing tuples and integers, so `ast.literal_eval` is just fine
* The instance in `crack_fortran` is just trying to lookup a function name dynamically
* The instance in `f90mod_rules` is looking at the result of `capi_maps.getarrdims(...)['rank']`, which is always a string representation of an integer
The f2py code is still littered with `eval`, but the remaining cases were harder to reason about.
Diffstat (limited to 'numpy/f2py/f90mod_rules.py')
-rw-r--r-- | numpy/f2py/f90mod_rules.py | 2 |
1 files changed, 1 insertions, 1 deletions
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 |