Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 88d3600

Browse filesBrowse files
QuLogicmeeseeksmachine
authored andcommitted
Backport PR #27595: Fix is_sorted_and_has_non_nan for byteswapped inputs.
1 parent 6eca804 commit 88d3600
Copy full SHA for 88d3600

File tree

Expand file treeCollapse file tree

2 files changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-2
lines changed

‎lib/matplotlib/tests/test_lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_lines.py
+2Lines 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

Copy file name to clipboardExpand all lines: src/_path_wrapper.cpp
+2-2Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.