From 30b837d14091c1eb9817b0093d450b9795c9106f Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 16 Jun 2020 20:30:19 +0200 Subject: [PATCH] Unbreak setattr_cm + mplcairo. --- lib/matplotlib/cbook/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index 05631ef4ca45..c05c9d02f321 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -2039,10 +2039,12 @@ def _setattr_cm(obj, **kwargs): if attr in obj.__dict__ or orig is sentinel: origs[attr] = orig else: - cls_orig = getattr(type(obj), attr) - if isinstance(cls_orig, property): + if isinstance(getattr(type(obj), attr), property): origs[attr] = orig - elif isinstance(cls_orig, types.FunctionType): + # Check whether orig is a bound method (`MethodType`). We can't + # check that `isinstance(getattr(type(obj), attr), FunctionType)`, + # because that returns False for pybind11-generated methods. + elif isinstance(orig, types.MethodType): origs[attr] = sentinel else: raise ValueError( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy