8000 Merge pull request #27597 from meeseeksmachine/auto-backport-of-pr-27… · matplotlib/matplotlib@86e5a45 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 86e5a45

Browse files
authored
Merge pull request #27597 from meeseeksmachine/auto-backport-of-pr-27595-on-v3.8.x
Backport PR #27595 on branch v3.8.x (Fix is_sorted_and_has_non_nan for byteswapped inputs.)
2 parents 6eca804 + 88d3600 commit 86e5a45

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/matplotlib/tests/test_lines.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ def test_is_sorted_and_has_non_nan():
249249
assert _path.is_sorted_and_has_non_nan(np.array([1, 2, 3]))
250250
assert _path.is_sorted_and_has_non_nan(np.array([1, np.nan, 3]))
251251
assert not _path.is_sorted_and_has_non_nan([3, 5] + [np.nan] * 100 + [0, 2])
252+
# [2, 256] byteswapped:
253+
assert not _path.is_sorted_and_has_non_nan(np.array([33554432, 65536], ">i4"))
252254
n = 2 * mlines.Line2D._subslice_optim_min_size
253255
plt.plot([np.nan] * n, range(n))
254256

src/_path_wrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,8 @@ static PyObject *Py_is_sorted_and_has_non_nan(PyObject *self, PyObject *obj)
699699
{
700700
bool result;
701701

702-
PyArrayObject *array = (PyArrayObject *)PyArray_FromAny(
703-
obj, NULL, 1, 1, 0, NULL);
702+
PyArrayObject *array = (PyArrayObject *)PyArray_CheckFromAny(
703+
obj, NULL, 1, 1, NPY_ARRAY_NOTSWAPPED, NULL);
704704

705705
if (array == NULL) {
706706
return NULL;

0 commit comments

Comments
 (0)
0