8000 Merge pull request #15786 from anntzer/safe_masked_invalid · matplotlib/matplotlib@61dfb19 · GitHub
[go: up one dir, main page]

Skip to content

Commit 61dfb19

Browse files
authored
Merge pull request #15786 from anntzer/safe_masked_invalid
Slightly clarify the implementation of safe_masked_invalid.
2 parents 56905d2 + 5c0e652 commit 61dfb19

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -747,12 +747,9 @@ def safezip(*args):
747747
def safe_masked_invalid(x, copy=False):
748748
x = np.array(x, subok=True, copy=copy)
749749
if not x.dtype.isnative:
750-
# Note that the argument to `byteswap` is 'inplace',
751-
# thus if we have already made a copy, do the byteswap in
752-
# place, else make a copy with the byte order swapped.
753-
# Be explicit that we are swapping the byte order of the dtype
754-
x = x.byteswap(copy).newbyteorder('S')
755-
750+
# If we have already made a copy, do the byteswap in place, else make a
751+
# copy with the byte order swapped.
752+
x = x.byteswap(inplace=copy).newbyteorder('N') # Swap to native order.
756753
try:
757754
xm = np.ma.masked_invalid(x, copy=False)
758755
xm.shrink_mask()

0 commit comments

Comments
 (0)
0