diff --git a/lib/matplotlib/cbook/deprecation.py b/lib/matplotlib/cbook/deprecation.py index e18169fa2173..9885ae8210d7 100644 --- a/lib/matplotlib/cbook/deprecation.py +++ b/lib/matplotlib/cbook/deprecation.py @@ -201,18 +201,21 @@ def finalize(wrapper, new_doc): class _deprecated_property(property): def __get__(self, instance, owner): - from . import _warn_external - _warn_external(message, category) + if instance is not None: + from . import _warn_external + _warn_external(message, category) return super().__get__(instance, owner) def __set__(self, instance, value): - from . import _warn_external - _warn_external(message, category) + if instance is not None: + from . import _warn_external + _warn_external(message, category) return super().__set__(instance, value) def __delete__(self, instance): - from . import _warn_external - _warn_external(message, category) + if instance is not None: + from . import _warn_external + _warn_external(message, category) return super().__delete__(instance) def finalize(_, new_doc):