Skip to content

Unbreak setattr_cm + mplcairo. #17648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down