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
Typically, for the versionadded and versionchanged directives, the decorator returns the class unchanged (except, of course, the docstring). So it must be transparent to the insinstance function.
As for the deprecated decorator, the call to __new__ is additionally modified to issue a warning. But, again, isinstance should work. Weird…
Have you done your own diagnosis of the problem, which might help?
i haven't done' any diagnosis beyond the diagnostic code attached. here's another small snippet that adds some insight into why isinstance() is failing... (based on the original code)
print([(type(x()), hex(id(type(x()))), x) for x in [Deprecated_, VersionAdded, VersionChanged]])
yields
[(<class '__main__.Deprecated_'>, '0x25fbedad588', <class '__main__.Deprecated_'>),
(<class '__main__.VersionAdded'>, '0x25fbedabf68', <AdapterWrapper at 0x0000025FC0582208 for type at 0x0000025FBEDABF68>),
(<class '__main__.VersionChanged'>, '0x25fbedace28', <AdapterWrapper at 0x0000025FC0520438 for type at 0x0000025FBEDACE28>)]
👍 The type of @deprecated class instances is the annotated class.
👎 The type of @versionadded and @versionchanged class instances is a wrapper to the annotated class.
Expected Behavior
Using isinstance() for classes annotated with the deprecated library should work as expected, regardless of the number of annotations.
Actual Behavior
Tell us what happens instead.
Environment
The text was updated successfully, but these errors were encountered: