Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-matplotlib for 
openSUSE:Factory checked in at 2021-07-10 22:54:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-matplotlib (Old)
 and      /work/SRC/openSUSE:Factory/.python-matplotlib.new.2625 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-matplotlib"

Sat Jul 10 22:54:05 2021 rev:88 rq:904589 version:3.4.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-matplotlib/python-matplotlib.changes      
2021-05-19 17:48:51.501665917 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-matplotlib.new.2625/python-matplotlib.changes
    2021-07-10 22:54:19.963837158 +0200
@@ -1,0 +2,9 @@
+Wed Jul  7 10:02:08 UTC 2021 - Antonio Larrosa <alarr...@suse.com>
+
+- 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
+
+-------------------------------------------------------------------

New:
----
  0001-FIX-Pillow-asarray-bug.patch
  0002-Dont-modify-arrays-when-masking-values-for-log.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-matplotlib.spec ++++++
--- /var/tmp/diff_new_pack.CEm8ur/_old  2021-07-10 22:54:20.739831169 +0200
+++ /var/tmp/diff_new_pack.CEm8ur/_new  2021-07-10 22:54:20.739831169 +0200
@@ -1,5 +1,5 @@
 #
-# spec file for package python-matplotlib-test
+# spec file for package python-matplotlib
 #
 # Copyright (c) 2021 SUSE LLC
 #
@@ -41,6 +41,10 @@
 # Bundled version of freetype and qhull for testing purposes only
 Source98:       http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz
 Source99:       
https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
+# PATCH-FIX-UPSTREAM 0001-FIX-Pillow-asarray-bug.patch - Fix from upstream for 
an error related to asarray
+Patch0:         0001-FIX-Pillow-asarray-bug.patch
+# PATCH-FIX-UPSTREAM 0002-Dont-modify-arrays-when-masking-values-for-log.patch 
- Fix from upstream for numpy 1.21.0
+Patch1:         0002-Dont-modify-arrays-when-masking-values-for-log.patch
 BuildRequires:  %{python_module Cycler >= 0.10}
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module kiwisolver >= 1.0.1}
@@ -245,6 +249,8 @@
 
 %prep
 %setup -q -n matplotlib-%{version}
+%patch0 -p1
+%patch1 -p1
 #copy freetype to the right location, so that matplotlib will not try to 
download it
 mkdir -p ~/.cache/matplotlib/
 SHA=($(sha256sum %{SOURCE98}))

++++++ 0001-FIX-Pillow-asarray-bug.patch ++++++
>From 5a4f6f035339d3573aa7b1a0ba67dfd4efb8f568 Mon Sep 17 00:00:00 2001
From: Jody Klymak <jkly...@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.
++++++ 0002-Dont-modify-arrays-when-masking-values-for-log.patch ++++++
>From 48eef460e8c861321e6d6a08a86ef0e45a863b59 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.anal...@gmail.com>
Date: Thu, 24 Jun 2021 04:11:39 -0400
Subject: [PATCH] Don't modify arrays when masking values for log.

NumPy 1.21.0 fixed a bug with `np.ma.masked_where` where `copy=False`
now modifies the input if it is masked, which we do not want to do.
`np.ma.array` defaults to not copying the data, but copies the mask
(adding the new mask), which is what we wanted with `copy=False`.
---
 lib/matplotlib/colors.py           |  4 ++--
 lib/matplotlib/tests/test_image.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py
index e0c42c5b69d5..0f6bf35dc440 100644
--- a/lib/matplotlib/colors.py
+++ b/lib/matplotlib/colors.py
@@ -1545,11 +1545,11 @@ class LogNorm(Normalize):
 
     def autoscale(self, A):
         # docstring inherited.
-        super().autoscale(np.ma.masked_less_equal(A, 0, copy=False))
+        super().autoscale(np.ma.array(A, mask=(A <= 0)))
 
     def autoscale_None(self, A):
         # docstring inherited.
-        super().autoscale_None(np.ma.masked_less_equal(A, 0, copy=False))
+        super().autoscale_None(np.ma.array(A, mask=(A <= 0)))
 
 
 @_make_norm_from_scale(
diff --git a/lib/matplotlib/tests/test_image.py 
b/lib/matplotlib/tests/test_image.py
index 42ed7479ae54..0e385ba7a805 100644
--- a/lib/matplotlib/tests/test_image.py
+++ b/lib/matplotlib/tests/test_image.py
@@ -1233,6 +1233,34 @@ def test_imshow_quantitynd():
     fig.canvas.draw()
 
 
+@check_figures_equal(extensions=['png'])
+def test_norm_change(fig_test, fig_ref):
+    # LogNorm should not mask anything invalid permanently.
+    data = np.full((5, 5), 1, dtype=np.float64)
+    data[0:2, :] = -1
+
+    masked_data = np.ma.array(data, mask=False)
+    masked_data.mask[0:2, 0:2] = True
+
+    cmap = plt.get_cmap('viridis').with_extremes(under='w')
+
+    ax = fig_test.subplots()
+    im = ax.imshow(data, norm=colors.LogNorm(vmin=0.5, vmax=1),
+                   extent=(0, 5, 0, 5), interpolation='nearest', cmap=cmap)
+    im.set_norm(colors.Normalize(vmin=-2, vmax=2))
+    im = ax.imshow(masked_data, norm=colors.LogNorm(vmin=0.5, vmax=1),
+                   extent=(5, 10, 5, 10), interpolation='nearest', cmap=cmap)
+    im.set_norm(colors.Normalize(vmin=-2, vmax=2))
+    ax.set(xlim=(0, 10), ylim=(0, 10))
+
+    ax = fig_ref.subplots()
+    ax.imshow(data, norm=colors.Normalize(vmin=-2, vmax=2),
+              extent=(0, 5, 0, 5), interpolation='nearest', cmap=cmap)
+    ax.imshow(masked_data, norm=colors.Normalize(vmin=-2, vmax=2),
+              extent=(5, 10, 5, 10), interpolation='nearest', cmap=cmap)
+    ax.set(xlim=(0, 10), ylim=(0, 10))
+
+
 @check_figures_equal(extensions=['png'])
 def test_huge_range_log(fig_test, fig_ref):
     data = np.full((5, 5), -1, dtype=np.float64)

Reply via email to