[Numpy-svn] [numpy/numpy] eb5adf: BUG: Incref items in np.take on error as they are ...

GitHub noreply@github....
Thu Feb 28 12:32:48 CST 2013


  Branch: refs/heads/maintenance/1.7.x
  Home:   https://github.com/numpy/numpy
  Commit: eb5adfbfbf5c3318fe440268ed7d488b26bca812
      https://github.com/numpy/numpy/commit/eb5adfbfbf5c3318fe440268ed7d488b26bca812
  Author: Sebastian Berg <sebastian@sipsolutions.net>
  Date:   2013-02-28 (Thu, 28 Feb 2013)

  Changed paths:
    M numpy/core/src/multiarray/item_selection.c
    A numpy/core/tests/test_item_selection.py
    M numpy/core/tests/test_regression.py

  Log Message:
  -----------
  BUG: Incref items in np.take on error as they are decrefed later

When take fails during copying due to out of bound indices, then the already
copied items will be decref'd on array destruction. To avoid that, as well
as possible overlapping or already initialized object arrays, decref and
incref during the copy operation itself. Note that all basic types but
object use their own fasttake, so this does not change anything for them.

Also use new (conflicting) numpy/core/tests/test_item_selection.py with
small modifications.


  Commit: 907e382d2f7419ae54aaf03f14095241e4fa9e3a
      https://github.com/numpy/numpy/commit/907e382d2f7419ae54aaf03f14095241e4fa9e3a
  Author: Sebastian Berg <sebastian@sipsolutions.net>
  Date:   2013-02-28 (Thu, 28 Feb 2013)

  Changed paths:
    M numpy/core/tests/test_item_selection.py

  Log Message:
  -----------
  TST: Add test for np.take refcounting

Also make the testcase for take a class.


  Commit: bff13facdafbe944c6fd6204a8d0defd9a110985
      https://github.com/numpy/numpy/commit/bff13facdafbe944c6fd6204a8d0defd9a110985
  Author: Sebastian Berg <sebastian@sipsolutions.net>
  Date:   2013-02-28 (Thu, 28 Feb 2013)

  Changed paths:
    M numpy/core/src/multiarray/item_selection.c
    M numpy/core/tests/test_indexerrors.py

  Log Message:
  -----------
  BUG: non-empty takes on empty axes failed for clip/wrap logic

These did no checking for this special case. And thus, wrap would go
into infinite loops trying to adjust the index, and clip would (probably)
segfault. This raises IndexError explicitely beforehand.


  Commit: 9231850d62e338433cca046a481eb951a7096fee
      https://github.com/numpy/numpy/commit/9231850d62e338433cca046a481eb951a7096fee
  Author: njsmith <njs@pobox.com>
  Date:   2013-02-28 (Thu, 28 Feb 2013)

  Changed paths:
    M numpy/core/src/multiarray/item_selection.c
    M numpy/core/tests/test_indexerrors.py
    A numpy/core/tests/test_item_selection.py
    M numpy/core/tests/test_regression.py

  Log Message:
  -----------
  Merge pull request #3039 from seberg/backport-object-take

Backport object take


Compare: https://github.com/numpy/numpy/compare/aede7e07e567...9231850d62e3


More information about the Numpy-svn mailing list