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 580740a

Browse filesBrowse files
committed
Fix is_sorted_and_has_non_nan for byteswapped inputs.
1 parent 8f296db commit 580740a
Copy full SHA for 580740a

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
@@ -246,6 +246,8 @@ def test_is_sorted_and_has_non_nan():
246246
assert _path.is_sorted_and_has_non_nan(np.array([1, 2, 3]))
247247
assert _path.is_sorted_and_has_non_nan(np.array([1, np.nan, 3]))
248248
assert not _path.is_sorted_and_has_non_nan([3, 5] + [np.nan] * 100 + [0, 2])
249+
# [2, 256] byteswapped:
250+
assert not _path.is_sorted_and_has_non_nan(np.array([33554432, 65536], ">i4"))
249251
n = 2 * mlines.Line2D._subslice_optim_min_size
250252
plt.plot([np.nan] * n, range(n))
251253

‎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
@@ -707,8 +707,8 @@ static PyObject *Py_is_sorted_and_has_non_nan(PyObject *self, PyObject *obj)
707707
{
708708
bool result;
709709

710-
PyArrayObject *array = (PyArrayObject *)PyArray_FromAny(
711-
obj, NULL, 1, 1, 0, NULL);
710+
PyArrayObject *array = (PyArrayObject *)PyArray_CheckFromAny(
711+
obj, NULL, 1, 1, NPY_ARRAY_NOTSWAPPED, NULL);
712712

713713
if (array == NULL) {
714714
return NULL;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.