diff options
| author | Sebastian Berg <sebastianb@nvidia.com> | 2022-10-12 10:52:50 +0200 |
|---|---|---|
| committer | Sebastian Berg <sebastianb@nvidia.com> | 2022-10-12 10:52:50 +0200 |
| commit | d9da02df4389a250fa1b54192700b15c84052034 (patch) | |
| tree | e1c7a0bdbb9e793c746380336a56d08dc83c2d74 | |
| parent | 4ecc03549750e733690d057f7a9c06909788a586 (diff) | |
| download | numpy-d9da02df4389a250fa1b54192700b15c84052034.tar.gz | |
DOC,TST: Improve overflow error message and adjust test
| -rw-r--r-- | numpy/core/src/multiarray/arraytypes.c.src | 2 | ||||
| -rw-r--r-- | numpy/core/tests/test_nep50_promotions.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index 69422d5e2..b7c339aa2 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -305,7 +305,7 @@ static int else { /* Live in the future, outright error: */ PyErr_Format(PyExc_OverflowError, - "Python int %R too large to convert to %S", obj, descr); + "Python integer %R out of bounds for %S", obj, descr); Py_DECREF(descr); return -1; } diff --git a/numpy/core/tests/test_nep50_promotions.py b/numpy/core/tests/test_nep50_promotions.py index 4bc034920..be6cf92a5 100644 --- a/numpy/core/tests/test_nep50_promotions.py +++ b/numpy/core/tests/test_nep50_promotions.py @@ -165,7 +165,8 @@ def test_nep50_integer_conversion_errors(): np.uint8(1) + 300 # Error message depends on platform (maybe unsigned int or unsigned long) - with pytest.raises(OverflowError, match=".*unsigned"): + with pytest.raises(OverflowError, + match="Python integer -1 out of bounds for uint8"): np.uint8(1) + -1 |
