[Numpy-svn] [numpy/numpy] 2dd299: BUG: guard against replacing constants without '_'...

GitHub noreply at github.com
Sat Jan 28 22:29:27 EST 2017


  Branch: refs/heads/maintenance/1.12.x
  Home:   https://github.com/numpy/numpy
  Commit: 2dd299311d55298ce1e26c4073f0aa5728ad5554
      https://github.com/numpy/numpy/commit/2dd299311d55298ce1e26c4073f0aa5728ad5554
  Author: jutke <jutke at allstate.com>
  Date:   2017-01-28 (Sat, 28 Jan 2017)

  Changed paths:
    M numpy/f2py/crackfortran.py

  Log Message:
  -----------
  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.


  Commit: 70c82bf8fa5acd56022ff9c20ac19873ead9f80c
      https://github.com/numpy/numpy/commit/70c82bf8fa5acd56022ff9c20ac19873ead9f80c
  Author: jutke <jutke at allstate.com>
  Date:   2017-01-28 (Sat, 28 Jan 2017)

  Changed paths:
    A numpy/f2py/tests/src/parameter/constant_compound.f90
    M numpy/f2py/tests/test_parameter.py

  Log Message:
  -----------
  TST: adding tests for compound constant provided by @zerothi

This is a test code provided as a patch by @zerothi checking
the compound constant parsing.


  Commit: bb05f40302ba418b28e71b6538a649d27d937a3f
      https://github.com/numpy/numpy/commit/bb05f40302ba418b28e71b6538a649d27d937a3f
  Author: jutke <jutke at allstate.com>
  Date:   2017-01-28 (Sat, 28 Jan 2017)

  Changed paths:
    A numpy/f2py/tests/src/parameter/constant_non_compound.f90
    M numpy/f2py/tests/test_parameter.py

  Log Message:
  -----------
  TST: adding test for constants without compound kind spec

This augments the test in constant_compound.f90 by
using constants without a compound kind spec to
illustrate the case that led to the
reporting of issue #8493


  Commit: d676ce2aae0ee06f2e892e45cdcb6e783c51b864
      https://github.com/numpy/numpy/commit/d676ce2aae0ee06f2e892e45cdcb6e783c51b864
  Author: jutke <jutke at allstate.com>
  Date:   2017-01-28 (Sat, 28 Jan 2017)

  Changed paths:
    M numpy/f2py/crackfortran.py

  Log Message:
  -----------
  STY: space around operator

per request from @charris


  Commit: ee99ca57b5bf37ac512ea6a5308ad5efb54fa4c7
      https://github.com/numpy/numpy/commit/ee99ca57b5bf37ac512ea6a5308ad5efb54fa4c7
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2017-01-28 (Sat, 28 Jan 2017)

  Changed paths:
    M numpy/f2py/crackfortran.py
    A numpy/f2py/tests/src/parameter/constant_compound.f90
    A numpy/f2py/tests/src/parameter/constant_non_compound.f90
    M numpy/f2py/tests/test_parameter.py

  Log Message:
  -----------
  Merge pull request #8543 from charris/backport-8494

BUG: guard against replacing constants without '_' spec


Compare: https://github.com/numpy/numpy/compare/33425bc4473f...ee99ca57b5bf


More information about the Numpy-svn mailing list