[Numpy-svn] [numpy/numpy] 0bf907: BUG: Fix numerous bugs related to zero-width strin...

GitHub noreply at github.com
Thu Jun 2 11:26:54 EDT 2016


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 0bf907ac5ed0d3c3917cd55d0511633ea8feb8f3
      https://github.com/numpy/numpy/commit/0bf907ac5ed0d3c3917cd55d0511633ea8feb8f3
  Author: Erik M. Bray <embray at stsci.edu>
  Date:   2016-05-31 (Tue, 31 May 2016)

  Changed paths:
    M numpy/core/_internal.py
    M numpy/core/records.py
    M numpy/core/src/multiarray/convert.c
    M numpy/core/src/multiarray/ctors.c
    M numpy/core/src/multiarray/ctors.h
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/src/multiarray/dtype_transfer.c
    M numpy/core/src/multiarray/mapping.c
    M numpy/core/src/multiarray/methods.c
    M numpy/core/tests/test_dtype.py
    M numpy/core/tests/test_multiarray.py
    M numpy/core/tests/test_records.py

  Log Message:
  -----------
  BUG: Fix numerous bugs related to zero-width string arrays (#473, #1901, #2196, #2585, #4955)

PyArray_NewFromDescr normally does not allow zero-width string dtypes (or rather, it automatically converts them to 1-width strings).  This affects any code that uses PyArray_NewFromDescr, which is a lot.  So we extend PyArray_NewFromDescr_int to allow disabling this functionality in a couple narrow cases where it's appropriate--one is when extracting a field from a structured array that has a zero-width string dtype (which, intentionally or not, has been allowed).  The other, which is related, is returning a view of an array that has a zero-width string dtype.  This shouldn't otherwise break or change any existing behavior.

Remove roadblocks to creating structured dtypes with zero-width fields using dict-based constructors (this was possible by other means such as the list-based constructor--with the previous fix in particular it should not be necessary to block this anymore).

Adds tests based on the tests cases given in the issues this is fixing.

Fix a bug with array to zero-width array assignment revealed by the tests.  I am slightly concerned that the blunt-force check for this in raw_array_assign_array may be masking a bug somewhere else though.


  Commit: 7a50050386cf05b94c16ba5e8676a68a23cbd6b8
      https://github.com/numpy/numpy/commit/7a50050386cf05b94c16ba5e8676a68a23cbd6b8
  Author: Erik M. Bray <erik.bray at lri.fr>
  Date:   2016-05-31 (Tue, 31 May 2016)

  Changed paths:
    M numpy/core/src/multiarray/ctors.c
    M numpy/core/src/multiarray/shape.c
    M numpy/core/tests/test_multiarray.py

  Log Message:
  -----------
  BUG: Fix indexing a nested structured type that contains a zero-width structure (i.e. with underlying dtype V0 as opposed to S0).

Fix bug with reshape of zero-width array.

See #6430


  Commit: db7c0b74d3d85521769042ff91309baeb57aae0d
      https://github.com/numpy/numpy/commit/db7c0b74d3d85521769042ff91309baeb57aae0d
  Author: Erik M. Bray <erik.bray at lri.fr>
  Date:   2016-05-31 (Tue, 31 May 2016)

  Changed paths:
    M numpy/core/src/multiarray/arrayobject.c
    M numpy/core/tests/test_multiarray.py

  Log Message:
  -----------
  BUG: Change ndarray.__new__ to allow zero-width data types, and in particular without converting zero-width strings to a one-width string dtype.

ndarray.__new__, being relatively low-level, should not be mangling the requested dtype when creating an array.

See #6430


  Commit: ee02cdda6c8d135098baa1d5afe41fd4996d587c
      https://github.com/numpy/numpy/commit/ee02cdda6c8d135098baa1d5afe41fd4996d587c
  Author: Erik M. Bray <erik.bray at lri.fr>
  Date:   2016-05-31 (Tue, 31 May 2016)

  Changed paths:
    M numpy/core/src/multiarray/convert.c
    M numpy/core/src/multiarray/ctors.c
    M numpy/core/tests/test_multiarray.py
    M numpy/lib/format.py
    M numpy/lib/npyio.py

  Log Message:
  -----------
  BUG: Fixes to reading and writing of empty arrays, and in particular arrays with empty dtypes. See #6430


  Commit: fd95d10f4d7ed8f3cb66e4f7e73c184be13f395e
      https://github.com/numpy/numpy/commit/fd95d10f4d7ed8f3cb66e4f7e73c184be13f395e
  Author: Erik M. Bray <erik.bray at lri.fr>
  Date:   2016-05-31 (Tue, 31 May 2016)

  Changed paths:
    M numpy/lib/npyio.py

  Log Message:
  -----------
  STY: Misc whitespace cleanup.


  Commit: 945c308e96fb815729e8f8aeb0ad6b39b8bdf84a
      https://github.com/numpy/numpy/commit/945c308e96fb815729e8f8aeb0ad6b39b8bdf84a
  Author: ahaldane <ealloc at gmail.com>
  Date:   2016-06-02 (Thu, 02 Jun 2016)

  Changed paths:
    M numpy/core/_internal.py
    M numpy/core/records.py
    M numpy/core/src/multiarray/arrayobject.c
    M numpy/core/src/multiarray/convert.c
    M numpy/core/src/multiarray/ctors.c
    M numpy/core/src/multiarray/ctors.h
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/src/multiarray/dtype_transfer.c
    M numpy/core/src/multiarray/mapping.c
    M numpy/core/src/multiarray/methods.c
    M numpy/core/src/multiarray/shape.c
    M numpy/core/tests/test_dtype.py
    M numpy/core/tests/test_multiarray.py
    M numpy/core/tests/test_records.py
    M numpy/lib/format.py
    M numpy/lib/npyio.py

  Log Message:
  -----------
  Merge pull request #6430 from embray/issue-473

Fix issues with zero-width string fields


Compare: https://github.com/numpy/numpy/compare/bd82a0dfa39c...945c308e96fb


More information about the Numpy-svn mailing list