1
0
python-matplotlib/0001-FIX-Pillow-asarray-bug.patch
Markéta Machová 1e86cb3b45 Accepting request 904573 from home:alarrosa:branches:devel:languages:python:numeric
- Add patches from upstream to fix an raised exception saying
  "__array__(): takes 1 positional argument but 2 were given"
  and an incompatibility with numpy 1.21.0 (slightly rebased):
  * 0001-FIX-Pillow-asarray-bug.patch
  * 0002-Dont-modify-arrays-when-masking-values-for-log.patch

OBS-URL: https://build.opensuse.org/request/show/904573
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-matplotlib?expand=0&rev=53
2021-07-07 12:45:05 +00:00

23 lines
840 B
Diff

From 5a4f6f035339d3573aa7b1a0ba67dfd4efb8f568 Mon Sep 17 00:00:00 2001
From: Jody Klymak <jklymak@gmail.com>
Date: Thu, 1 Jul 2021 22:10:10 -0700
Subject: [PATCH] FIX: PILLOW asarray bug
---
lib/matplotlib/image.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py
index a59499cd966..b2c9c4b22f9 100644
--- a/lib/matplotlib/image.py
+++ b/lib/matplotlib/image.py
@@ -1688,7 +1688,7 @@ def _pil_png_to_float_array(pil_png):
mode = pil_png.mode
rawmode = pil_png.png.im_rawmode
if rawmode == "1": # Grayscale.
- return np.asarray(pil_png, np.float32)
+ return np.asarray(pil_png).astype(np.float32)
if rawmode == "L;2": # Grayscale.
return np.divide(pil_png, 2**2 - 1, dtype=np.float32)
if rawmode == "L;4": # Grayscale.