Skip to content

MAINT: Eliminate some calls to eval#15249

Merged
mattip merged 2 commits intonumpy:masterfrom
eric-wieser:remove-eval
Jan 13, 2020
Merged

MAINT: Eliminate some calls to eval#15249
mattip merged 2 commits intonumpy:masterfrom
eric-wieser:remove-eval

Conversation

@eric-wieser
Copy link
Member

  • 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.

@mattip
Copy link
Member

mattip commented Jan 6, 2020

ast.literal_eval does not like b'(2,3)'

@eric-wieser
Copy link
Member Author

Have some local work to fix that based on #15254

* 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.
@mattip mattip merged commit ea75cf5 into numpy:master Jan 13, 2020
@mattip
Copy link
Member

mattip commented Jan 13, 2020

Thanks @eric-wieser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments