diff options
author | jutke <jutke@allstate.com> | 2017-01-17 12:33:34 -0600 |
---|---|---|
committer | jutke <jutke@allstate.com> | 2017-01-20 09:31:03 -0600 |
commit | 892c54cda15163552fa2245b476aa765f2aa2061 (patch) | |
tree | 3c9e935e69e8956e49ffce2cc1587e4304b2c994 /numpy/core/fromnumeric.py | |
parent | 6f378b36f16d1667704234a2f6287588a04e210b (diff) | |
download | numpy-892c54cda15163552fa2245b476aa765f2aa2061.tar.gz |
BUG: guard against replacing constants without '_' spec
fixes #8493
In the reported problem snippet the attempt to infer the type of
parameter (wasize=maxiterates*2)
leads to a lookup of maxiterates in the logic of get_parameters
which finds and correctly assigns to 'v' the value string '50000'
However, then in the logic proceds to attempt to split off any
underscore-appended precision spec from v_ which yields ['50000']
because there is no underscore.
Finally line
v = ''.join(v_[:-1]).lower().replace(v_[-1].lower(), '')
if not quarded by the newly introduced lengthtest sets v to empty
because [:-1] of a list with one element yields an empty list.
Subsequently the type inference by running eval on an empty string
fails with the error message quoted.
The introduced length check appears to correct this problem.
Diffstat (limited to 'numpy/core/fromnumeric.py')
0 files changed, 0 insertions, 0 deletions