matplotlib: autopkgtest "tkagg" fails for 3.6.3-1fakesync1

Bug #2020666 reported by Simon Chopin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
matplotlib (Ubuntu)
Fix Released
Undecided
Simon Chopin

Bug Description

The autopkgtest "tkagg" fails on all archs with the following error:

autopkgtest [14:18:05]: test tkagg: [-----------------------
=== TkAgg ===
=== python3.11 ===
Traceback (most recent call last):
  File "/tmp/autopkgtest.DLVKq4/autopkgtest_tmp/test.py", line 9, in <module>
    plt.plot(range(5), range(5))
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 2748, in plot
    return gca().plot(
           ^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 2245, in gca
    return gcf().gca()
           ^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 842, in gcf
    return figure()
           ^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/_api/deprecation.py", line 454, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 783, in figure
    manager = new_figure_manager(
              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 359, in new_figure_manager
    return _get_backend_mod().new_figure_manager(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 3513, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 3518, in new_figure_manager_given_figure
    return cls.FigureCanvas.new_manager(figure, num)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 1703, in new_manager
    return cls.manager_class.create_with_canvas(cls, figure, num)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_tk.py", line 481, in create_with_canvas
    manager = cls(canvas, num, window)
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_tk.py", line 431, in __init__
    super().__init__(canvas, num)
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 2804, in __init__
    self.toolbar = self._toolbar2_class(self.canvas)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_tk.py", line 590, in __init__
    self._buttons[text] = button = self._Button(
                                   ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_tk.py", line 792, in _Button
    NavigationToolbar2Tk._set_image_for_button(self, b)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_tk.py", line 734, in _set_image_for_button
    im_alt = _recolor_icon(im, foreground)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_tk.py", line 723, in _recolor_icon
    return Image.fromarray(image_data, mode="RGBA")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 3103, in fromarray
    return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 3019, in frombuffer
    im = im._new(core.map_buffer(data, size, decoder_name, 0, args))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: buffer is not large enough

Revision history for this message
Simon Chopin (schopin) wrote :

Assigning to myself as part of my +1 rotation.

The tests fail also locally on a LXD runner, which probably rules out OOM issues.

Revision history for this message
Simon Chopin (schopin) wrote :

I tracked it down to us triggering a latent bug in matplotlib 3.6 introduced by https://github.com/matplotlib/matplotlib/commit/ff60b288cc83e68b0189b63e6c2c205972b1b6b9

The code assumes that the picture is RGBA-encoded, which the original file in the source package is. However, Ubuntu runs advancecomp as part of pkgbinarymangler, which changes the color encoding to reduce its size, thus triggering the latent bug in the code (which is otherwise fairly hard to trigger AFAICT)

I won't forward the changes to Debian since they're not hitting the bug.

Changed in matplotlib (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package matplotlib - 3.6.3-1ubuntu2

---------------
matplotlib (3.6.3-1ubuntu2) mantic; urgency=medium

  * Actually apply the bugfix patch from previous upload.

 -- Simon Chopin <email address hidden> Fri, 26 May 2023 09:47:34 +0200

Changed in matplotlib (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.