From e5d01aa4774f03a41736d863710802ee28791afb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Aug 2023 03:28:58 -0400 Subject: [PATCH] Fix size inferral when using cairocffi With that package, rectangles appear to just be tuples, not named tuples like with pycairo. Fixes #26523 --- lib/matplotlib/backends/backend_cairo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_cairo.py b/lib/matplotlib/backends/backend_cairo.py index c733f3f9d3d7..421d857b0a03 100644 --- a/lib/matplotlib/backends/backend_cairo.py +++ b/lib/matplotlib/backends/backend_cairo.py @@ -95,7 +95,7 @@ def set_context(self, ctx): rect, *rest = ctx.copy_clip_rectangle_list() if rest: raise TypeError("Cannot infer surface size") - size = rect.width, rect.height + _, _, *size = rect ctx.restore() self.gc.ctx = ctx self.width, self.height = size