Skip to content

Commit 2ce4d7e

Browse files
committed
Document limitations on @deprecated with multiple-inheritance.
This is tricky to fix correctly and anyways quite rare, so just document the limitation for now.
1 parent 327cfcf commit 2ce4d7e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/matplotlib/cbook/deprecation.py

+6
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ def deprecated(since, *, message='', name='', alternative='', pending=False,
119119
``@staticmethod`` (i.e., `deprecated` should directly decorate the
120120
underlying callable), but *over* ``@property``.
121121
122+
When deprecating a class ``C`` intended to be used as a base class in a
123+
multiple inheritance hierarchy, ``C`` *must* define an ``__init__`` method
124+
(if ``C`` instead inherited its ``__init__`` from its own base class, then
125+
``@deprecated`` would mess up ``__init__`` inheritance when installing its
126+
own (deprecation-emitting) ``C.__init__``).
127+
122128
Parameters
123129
----------
124130
since : str

0 commit comments

Comments
 (0)