[Numpy-svn] [numpy/numpy] 4c68a3: ENH: report bad value and dimenion to IndexError e...

GitHub noreply at github.com
Fri Jun 15 07:06:53 EDT 2012


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 4c68a33a5b75cbfed1aa0b3b23e947563b9a513a
      https://github.com/numpy/numpy/commit/4c68a33a5b75cbfed1aa0b3b23e947563b9a513a
  Author: Thouis (Ray) Jones <thouis at gmail.com>
  Date:   2012-06-06 (Wed, 06 Jun 2012)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src
    M numpy/core/src/multiarray/common.c
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/src/multiarray/item_selection.c
    M numpy/core/src/multiarray/iterators.c
    M numpy/core/src/multiarray/mapping.c

  Log Message:
  -----------
  ENH: report bad value and dimenion to IndexError exceptions


  Commit: 56f865980447b2fc5475b1b71ef7347383660782
      https://github.com/numpy/numpy/commit/56f865980447b2fc5475b1b71ef7347383660782
  Author: Thouis (Ray) Jones <thouis at gmail.com>
  Date:   2012-06-06 (Wed, 06 Jun 2012)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src
    M numpy/core/src/multiarray/common.c
    M numpy/core/src/multiarray/common.h
    M numpy/core/src/multiarray/ctors.c
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/src/multiarray/item_selection.c
    M numpy/core/src/multiarray/iterators.c
    M numpy/core/src/multiarray/mapping.c
    M numpy/core/src/multiarray/methods.c
    M numpy/core/src/multiarray/multiarraymodule.c

  Log Message:
  -----------
  Add check_and_adjust_index(), and replace most index checks with it.

This commit adds a check_and_adjust_index(npy_intp *index, npy_intp max, int axis) function
which checks index against max, setting an IndexError and returning -1 if it's not valid,
and otherwise adjusting index in-place to handle Python's negative indexing, and returning 0.

It also changes most places in the code where indexes were being checked and adjusted with a
call to this function.


  Commit: 330468f751410f56eeacb29cb26320faeaec5135
      https://github.com/numpy/numpy/commit/330468f751410f56eeacb29cb26320faeaec5135
  Author: Thouis (Ray) Jones <thouis at gmail.com>
  Date:   2012-06-06 (Wed, 06 Jun 2012)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src
    M numpy/core/src/multiarray/iterators.c
    M numpy/core/src/multiarray/mapping.c
    A numpy/core/tests/test_indexerrors.py

  Log Message:
  -----------
  Add coverage tests for IndexErrors, fix one bug, clean up two checks

Adds numpy/core/tests/test_indexerrors.py with tests to cover failure cases in indexing not covered
by other tests.

Added a missing check for invalid index in multiarray/iterators.c:iter_ass_sub_int().
Used the new checking code in multiarray/iterators.c:iter_ass_subscript().
Changed a ValueError to an IndexError in multiarray/mapping.c:PyArray_MapIterBind().


  Commit: a83e212d40ea4ccb49ab75a60fd5d7afa9307c2a
      https://github.com/numpy/numpy/commit/a83e212d40ea4ccb49ab75a60fd5d7afa9307c2a
  Author: Thouis (Ray) Jones <thouis at gmail.com>
  Date:   2012-06-15 (Fri, 15 Jun 2012)

  Changed paths:
    M numpy/core/src/multiarray/mapping.c

  Log Message:
  -----------
  Work around Python 2.4's Py_ssize_t not being the same as npyint_p


  Commit: 004082c59c102e2f458a595db8adecd21c18793f
      https://github.com/numpy/numpy/commit/004082c59c102e2f458a595db8adecd21c18793f
  Author: Nathaniel J. Smith <njs at pobox.com>
  Date:   2012-06-15 (Fri, 15 Jun 2012)

  Changed paths:
    M numpy/core/src/multiarray/common.c
    M numpy/core/src/multiarray/common.h

  Log Message:
  -----------
  Tweak out-of-bounds exception message based on list feedback


  Commit: 1b6582d98c58afd977a69ac49f7e8e0d08a800b8
      https://github.com/numpy/numpy/commit/1b6582d98c58afd977a69ac49f7e8e0d08a800b8
  Author: Nathaniel J. Smith <njs at pobox.com>
  Date:   2012-06-15 (Fri, 15 Jun 2012)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src
    M numpy/core/src/multiarray/common.c
    M numpy/core/src/multiarray/common.h
    M numpy/core/src/multiarray/ctors.c
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/src/multiarray/item_selection.c
    M numpy/core/src/multiarray/iterators.c
    M numpy/core/src/multiarray/mapping.c
    M numpy/core/src/multiarray/methods.c
    M numpy/core/src/multiarray/multiarraymodule.c
    A numpy/core/tests/test_indexerrors.py

  Log Message:
  -----------
  Merge branch 'index_error_info'


Compare: https://github.com/numpy/numpy/compare/6fe584f1d277...1b6582d98c58


More information about the Numpy-svn mailing list