summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/textreading/rows.c5
-rw-r--r--numpy/lib/tests/test_io.py6
-rw-r--r--numpy/lib/tests/test_loadtxt.py16
3 files changed, 26 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/textreading/rows.c b/numpy/core/src/multiarray/textreading/rows.c
index 2ca976060..e30ff835e 100644
--- a/numpy/core/src/multiarray/textreading/rows.c
+++ b/numpy/core/src/multiarray/textreading/rows.c
@@ -389,6 +389,11 @@ read_rows(stream *s,
}
}
+ /*
+ * The following function calls represent the main "conversion"
+ * step, i.e. parsing the unicode string for each field and storing
+ * the result in the array.
+ */
int parser_res;
Py_UCS4 *str = ts.field_buffer + fields[col].offset;
Py_UCS4 *end = ts.field_buffer + fields[col + 1].offset - 1;
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 37404cb41..a2758123b 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -779,6 +779,8 @@ class TestLoadTxt(LoadTxtBase):
a = np.array([[1, 2, 3], [4, 5, 6]], int)
assert_array_equal(x, a)
+ @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_comments_multi_chars(self):
c = TextIO()
c.write('/* comment\n1,2,3,5\n')
@@ -995,6 +997,8 @@ class TestLoadTxt(LoadTxtBase):
c, dtype=dt, converters=float.fromhex, encoding="latin1")
assert_equal(res, tgt, err_msg="%s" % dt)
+ @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_default_float_converter_no_default_hex_conversion(self):
"""
Ensure that fromhex is only used for values with the correct prefix and
@@ -1005,6 +1009,8 @@ class TestLoadTxt(LoadTxtBase):
match=".*convert string 'a' to float64 at row 0, column 1"):
np.loadtxt(c)
+ @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_default_float_converter_exception(self):
"""
Ensure that the exception message raised during failed floating point
diff --git a/numpy/lib/tests/test_loadtxt.py b/numpy/lib/tests/test_loadtxt.py
index 0ebcf12dc..df88cef95 100644
--- a/numpy/lib/tests/test_loadtxt.py
+++ b/numpy/lib/tests/test_loadtxt.py
@@ -11,7 +11,7 @@ from io import StringIO
import numpy as np
from numpy.ma.testutils import assert_equal
-from numpy.testing import assert_array_equal, HAS_REFCOUNT
+from numpy.testing import assert_array_equal, HAS_REFCOUNT, IS_PYPY
def test_scientific_notation():
@@ -200,6 +200,8 @@ def test_maxrows_no_blank_lines(dtype):
assert_equal(res, np.array([["1.5", "2.5"], ["3.0", "4.0"]], dtype=dtype))
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", (np.dtype("f8"), np.dtype("i2")))
def test_exception_message_bad_values(dtype):
txt = StringIO("1,2\n3,XXX\n5,6")
@@ -381,6 +383,8 @@ def test_bool():
assert_array_equal(res.view(np.uint8), [[1, 0], [1, 1]])
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", np.typecodes["AllInteger"])
def test_integer_signs(dtype):
dtype = np.dtype(dtype)
@@ -396,6 +400,8 @@ def test_integer_signs(dtype):
np.loadtxt([f"{sign}2\n"], dtype=dtype)
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", np.typecodes["AllInteger"])
def test_implicit_cast_float_to_int_fails(dtype):
txt = StringIO("1.0, 2.1, 3.7\n4, 5, 6")
@@ -466,6 +472,8 @@ def test_object_cleanup_on_read_error():
assert sys.getrefcount(sentinel) == 2
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_character_not_bytes_compatible():
"""Test exception when a character cannot be encoded as 'S'."""
data = StringIO("–") # == \u2013
@@ -688,6 +696,8 @@ def test_unicode_whitespace_stripping_complex(dtype):
assert_array_equal(res, np.array([[1, 2+3j, 4+5j, 6-7j, 8j, 9j]] * 2))
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", "FD")
@pytest.mark.parametrize("field",
["1 +2j", "1+ 2j", "1+2 j", "1+-+3", "(1j", "(1", "(1+2j", "1+2j)"])
@@ -696,6 +706,8 @@ def test_bad_complex(dtype, field):
np.loadtxt([field + "\n"], dtype=dtype, delimiter=",")
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype",
np.typecodes["AllInteger"] + "efgdFDG" + "?")
def test_nul_character_error(dtype):
@@ -707,6 +719,8 @@ def test_nul_character_error(dtype):
np.loadtxt(["1\000"], dtype=dtype, delimiter=",", quotechar='"')
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype",
np.typecodes["AllInteger"] + "efgdFDG" + "?")
def test_no_thousands_support(dtype):