Closed
Description
Describe the bug
Using isinstance
on a @TrameApp()
decorated class throws a TypeError
.
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union
To Reproduce
Steps to reproduce the behavior:
- Run the following code.
Code
from trame.decorators import TrameApp
@TrameApp()
class TestApp:
server = None
t = TestApp()
print(isinstance(t, TestApp))
Expected behavior
I would assume isinstance
would work. This is not a critical problem though as we have other workarounds.
The problem is that the @TrameApp()
decorator returns a function that instantiates the class instead of returning a class itself. The TypeError
is thrown because we are checking if a object is an instance of a function, which is not possible to check.
Maybe isinstance
would never be a good way to handle this, either way it would be very useful to have a good way of checking the type of our app's instances.
Platform:
OS:
- Windows
- MacOS
- Linux
- Android
- iOS
Metadata
Metadata
Assignees
Labels
No labels