You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError: object.__init__() takes exactly one argument (the instance to initialize)
because the deprecation machinery grabs object.__init__ to install the deprecation emitter on Mixin. (This is not a theoretical case, see e.g. #18675.)
There's a few possible solutions:
"it's too rare, let's not bother"
forbid deprecation of classes where __init__ is not defined (which I think is the main failing case)
make cbook.deprecated actually create another class that inherits from Mixin and has its own __init__ (which gets wrapped in cbook.deprecated() and just calls super().__init__), instead of monkey-patching Mixin's original __init__.
forbid deprecation of classes where init is not defined (which I think is the main failing case)
Would that raise when I try to deprecate a class? If so, IMHO that's the right amount of effort to put in. The third solution feels a bit over-engineered. And the first might through confusing messages at our users.
Actually I'll take back what I said, we can't just forbid the deprecation of classes with no __init__, as they're perfectly fine as long as they're not involved in multiple inheritance, and there's actually cases where we deprecate such classes (e.g. currently IgnoredKeywordWarning).
Bug report
In
the last line raises a rather puzzling
because the deprecation machinery grabs
object.__init__
to install the deprecation emitter onMixin
. (This is not a theoretical case, see e.g. #18675.)There's a few possible solutions:
__init__
is not defined (which I think is the main failing case)cbook.deprecated
actually create another class that inherits fromMixin
and has its own__init__
(which gets wrapped incbook.deprecated()
and just callssuper().__init__
), instead of monkey-patchingMixin
's original__init__
.Matplotlib version
print(matplotlib.get_backend())
): n/aThe text was updated successfully, but these errors were encountered: