Skip to content
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