diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-06-17 14:39:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 14:39:35 +0300 |
commit | 95a6774007d1d7898c7da40d9989e9f1dd1b0f40 (patch) | |
tree | 96d6783f8c8897d3621e4c1c2392240f9d6ff23c /numpy | |
parent | 1fb7047b0ceba98d43b50ebb398be899ff8f6a1c (diff) | |
parent | 1fab43749913aaa63168e4fdaaefffa67e9da36f (diff) | |
download | numpy-95a6774007d1d7898c7da40d9989e9f1dd1b0f40.tar.gz |
Merge pull request #16623 from seberg/maint-init-stop-reading
BUG: Initialize stop-reading in array_from_text
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 3c3bcb387..c7d149577 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -3580,7 +3580,7 @@ array_from_text(PyArray_Descr *dtype, npy_intp num, char const *sep, size_t *nre npy_intp i; char *dptr, *clean_sep, *tmp; int err = 0; - int stop_reading_flag; /* -1 indicates end reached; -2 a parsing error */ + int stop_reading_flag = 0; /* -1 means end reached; -2 a parsing error */ npy_intp thisbuf = 0; npy_intp size; npy_intp bytes, totalbytes; diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index e116077f9..09adddf6d 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -4702,6 +4702,10 @@ class TestIO: e = np.array([-25041670086757, 104783749223640], dtype=np.int64) assert_array_equal(d, e) + def test_fromstring_count0(self): + d = np.fromstring("1,2", sep=",", dtype=np.int64, count=0) + assert d.shape == (0,) + def test_empty_files_binary(self): with open(self.filename, 'w') as f: pass |