8000 Merge pull request #12653 from anntzer/property-dont-warn-from-class · matplotlib/matplotlib@5eaa14c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5eaa14c

Browse files
authored
Merge pull request #12653 from anntzer/property-dont-warn-from-class
MNT: Don't warn when accessing deprecated properties from the class.
2 parents 8c44c4d + bb5d400 commit 5eaa14c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/matplotlib/cbook/deprecation.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,21 @@ def finalize(wrapper, new_doc):
201201

202202
class _deprecated_property(property):
203203
def __get__(self, instance, owner):
204-
from . import _warn_external
205-
_warn_external(message, category)
204+
if instance is not None:
205+
from . import _warn_external
206+
_warn_external(message, category)
206207
return super().__get__(instance, owner)
207208

208209
def __set__(self, instance, value):
209-
from . import _warn_external
210-
_warn_external(message, category)
210+
if instance is not None:
211+
from . import _warn_external
212+
_warn_external(message, category)
211213
return super().__set__(instance, value)
212214

213215
def __delete__(self, instance):
214-
from . import _warn_external
215-
_warn_external(message, category)
216+
if instance is not None:
217+
from . import _warn_external
218+
_warn_external(message, category)
216219
return super().__delete__(instance)
217220

218221
def finalize(_, new_doc):

0 commit comments

Comments
 (0)
0