[Numpy-svn] [numpy/numpy] f1cfc4: BUG: loadtxt fails with complex data in Python 3.

GitHub noreply at github.com
Wed Mar 11 14:24:33 EDT 2015


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: f1cfc4f00cb61a363976ea0e38c80500ab91d172
      https://github.com/numpy/numpy/commit/f1cfc4f00cb61a363976ea0e38c80500ab91d172
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-03-11 (Wed, 11 Mar 2015)

  Changed paths:
    M numpy/lib/npyio.py
    M numpy/lib/tests/test_io.py

  Log Message:
  -----------
  BUG: loadtxt fails with complex data in Python 3.

The problem is that the Python complex type constructor only accepts a
pair of numbers or a string, unlike other numeric types it does not work
with byte strings. The numpy error is subtle, as loadtxt opens the file
in the default text mode, but then converts the input lines to byte
strings when they are split into separate values. The fix here is to
convert the values back to strings in the complex converter.

Closes #5655.


  Commit: a866fdd2c9481de18241a27778679013042d5349
      https://github.com/numpy/numpy/commit/a866fdd2c9481de18241a27778679013042d5349
  Author: Jaime <jaime.frio at gmail.com>
  Date:   2015-03-11 (Wed, 11 Mar 2015)

  Changed paths:
    M numpy/lib/npyio.py
    M numpy/lib/tests/test_io.py

  Log Message:
  -----------
  Merge pull request #5666 from charris/fix-loadtxt-complex

BUG: loadtxt fails with complex data in Python 3.


Compare: https://github.com/numpy/numpy/compare/a7bea17c6798...a866fdd2c948


More information about the Numpy-svn mailing list