diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-01-14 09:38:42 -0600 |
|---|---|---|
| committer | Sebastian Berg <sebastian@sipsolutions.net> | 2022-01-14 20:07:07 -0600 |
| commit | cc67c19185ac21aecea7abf0c7e820b472e95b25 (patch) | |
| tree | c504a71c13d55502a2f10a89a765cccf82c88aaa /numpy/core/src/multiarray | |
| parent | 245af22c0c0459664da2f30502025abf16c3ceca (diff) | |
| download | numpy-cc67c19185ac21aecea7abf0c7e820b472e95b25.tar.gz | |
TST: Improve test coverage, replace impossible error with assert
Diffstat (limited to 'numpy/core/src/multiarray')
| -rw-r--r-- | numpy/core/src/multiarray/textreading/tokenize.c.src | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/numpy/core/src/multiarray/textreading/tokenize.c.src b/numpy/core/src/multiarray/textreading/tokenize.c.src index f5db64af6..75d0d6733 100644 --- a/numpy/core/src/multiarray/textreading/tokenize.c.src +++ b/numpy/core/src/multiarray/textreading/tokenize.c.src @@ -348,17 +348,12 @@ tokenize(stream *s, tokenizer_state *ts, parser_config *const config) } if (ts->buf_state == BUFFER_IS_FILEEND) { finished_reading_file = 1; - ts->pos = ts->end; /* should be guaranteed, but make sure. */ + ts->pos = ts->end; /* stream should ensure this. */ goto finish; } else if (ts->pos == ts->end) { - if (ts->buf_state != BUFFER_IS_LINEND) { - PyErr_SetString(PyExc_RuntimeError, - "Reader returned an empty buffer, " - "but did not indicate file or line end."); - return -1; - } - /* Otherwise, we are OK with this and assume an empty line. */ + /* This must be an empty line (and it must be indicated!). */ + assert(ts->buf_state == BUFFER_IS_LINEND); goto finish; } } |
