[Numpy-svn] [numpy/numpy] 4008bb: ENH: core: make unpickling with encoding='bytes' w...

GitHub noreply at github.com
Tue Jul 22 19:17:00 EDT 2014


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 4008bb41414184d875af4f733a3ff3d303b94a4a
      https://github.com/numpy/numpy/commit/4008bb41414184d875af4f733a3ff3d303b94a4a
  Author: Pauli Virtanen <pav at iki.fi>
  Date:   2014-07-22 (Tue, 22 Jul 2014)

  Changed paths:
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/tests/test_regression.py

  Log Message:
  -----------
  ENH: core: make unpickling with encoding='bytes' work

Make dtype.__setstate__ accept endian either as a byte string or unicode.

Also fix a missing error return introduced in c3551579, apparently
mistake.


  Commit: 16f39c80f69ae4695f2f940ccdff8b26db3a2a01
      https://github.com/numpy/numpy/commit/16f39c80f69ae4695f2f940ccdff8b26db3a2a01
  Author: Pauli Virtanen <pav at iki.fi>
  Date:   2014-07-22 (Tue, 22 Jul 2014)

  Changed paths:
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/tests/test_regression.py

  Log Message:
  -----------
  BUG: core: ensure unpickled dtype fields and names have correct types + coerce on Py3

That 'names' is a tuple and 'fields' a dict (when present) is assumed in
most of the code base, so check them during unpickling.

Also add coercion from bytes using ASCII codec on Python 3.  This is
never triggered in the "usual" case of loading Py3-generated pickles on
Py3, but can occur if loading Py2 generated pickles with
pickle.load(f, encoding='bytes'), which sometimes is the only working
option.

The ASCII codec is probably the safest choice and likely covers most use
cases.


  Commit: 809938d8dd481f789a3295a2cccce5aa521a6344
      https://github.com/numpy/numpy/commit/809938d8dd481f789a3295a2cccce5aa521a6344
  Author: Julian Taylor <juliantaylor108 at gmail.com>
  Date:   2014-07-23 (Wed, 23 Jul 2014)

  Changed paths:
    M numpy/core/src/multiarray/descriptor.c
    M numpy/core/tests/test_regression.py

  Log Message:
  -----------
  Merge pull request #4888 from pv/fix-bytes-encoding-unpickle

ENH: core: make unpickling with encoding='bytes' work


Compare: https://github.com/numpy/numpy/compare/a28bfa5780c6...809938d8dd48


More information about the Numpy-svn mailing list