diff options
author | Thomas Robitaille <thomas.robitaille@gmail.com> | 2015-03-05 23:44:30 +0100 |
---|---|---|
committer | Thomas Robitaille <thomas.robitaille@gmail.com> | 2015-03-06 20:59:09 +0100 |
commit | 2c3ef4cbe8af6fddd82d7e90433f92b23cbcdd37 (patch) | |
tree | 88756495a1d32e4a55cd7edc943cf4cf8d32d399 /doc | |
parent | 4cba5310c7b8d1a3aab7202209d238f569a8f9ff (diff) | |
download | numpy-2c3ef4cbe8af6fddd82d7e90433f92b23cbcdd37.tar.gz |
BUG: genfromtxt gave OverflorError for large integers
Fix StringConverter to avoid OverflowError in genfromtxt. Before, int(2**66) would work
(and return a ‘long’) but then np.array([2**66], dtype=np.integer) would not work and
return an OverflowError which would propagate to genfromtxt. This commit fixes this by
ensuring testing in advance whether an OverflowError will occur. In addition, this adds
an explicit np.int64 entry on systems where integer means int32. Values larger than
2**63-1 will be cast as float. This includes a regression test and adds an entry to the
release notes.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/1.10.0-notes.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/release/1.10.0-notes.rst b/doc/release/1.10.0-notes.rst index a07dca80f..36b0c38fb 100644 --- a/doc/release/1.10.0-notes.rst +++ b/doc/release/1.10.0-notes.rst @@ -162,6 +162,12 @@ what was provided by *np.allclose*. compare NaNs as equal by setting ``equal_nan=True``. Subclasses, such as *np.ma.MaskedArray*, are also preserved now. +*np.genfromtxt* now handles large integers correctly +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*np.genfromtxt* now correctly handles integers larger than ``2**31-1`` on +32-bit systems and larger than ``2**63-1`` on 64-bit systems (it previously +crashed with an ``OverflowError`` in these cases). Integers larger than +``2**63-1`` are converted to floating-point values. Changes ======= |