Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Subscripted generics cannot be used with class and instance checks #1332

Open
oberstet opened this issue Feb 29, 2020 · 0 comments

Comments

@oberstet
Copy link
Contributor

Code:

    @wamp.register('network.xbr.console.find_markets', check_types=True)
    def find_markets(self,
                     created_from: Optional[int] = None,
                     limit: Optional[int] = None,
                     include_owners: Optional[List[bytes]] = None,
                     include_actors: Optional[List[bytes]] = None,
                     include_titles: Optional[List[str]] = None,
                     include_descriptions: Optional[List[str]] = None,
                     include_tags: Optional[List[str]] = None,
                     include_apis: Optional[List[bytes]] = None,
                     details: Optional[CallDetails] = None) -> List[bytes]:
        pass

Traceback:

2020-02-29T22:27:08+0100 [Router      26746] XbrNetworkApi.onUserError(): "TypeError: Subscripted generics cannot be used with class and instance checks"
Traceback (most recent call last):
  File "/home/oberstet/scm/crossbario/autobahn-python/autobahn/wamp/protocol.py", line 1020, in onMessage
    on_reply = txaio.as_future(endpoint.fn, *invoke_args, **invoke_kwargs)
  File "/home/oberstet/scm/crossbario/txaio/txaio/tx.py", line 365, in as_future
    return ensureDeferred(fun(*args, **kwargs))
  File "/home/oberstet/cpy381_5/lib/python3.8/site-packages/twisted/internet/defer.py", line 911, in ensureDeferred
    return _cancellableInlineCallbacks(coro)
  File "/home/oberstet/cpy381_5/lib/python3.8/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
--- <exception caught here> ---
  File "/home/oberstet/cpy381_5/lib/python3.8/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/home/oberstet/scm/crossbario/autobahn-python/autobahn/wamp/protocol.py", line 506, in _type_check
    if not isinstance(arguments[name], kind.__args__):
  File "/home/oberstet/cpy381/lib/python3.8/typing.py", line 766, in __instancecheck__
    return self.__subclasscheck__(type(obj))
  File "/home/oberstet/cpy381/lib/python3.8/typing.py", line 774, in __subclasscheck__
    raise TypeError("Subscripted generics cannot be used with"
builtins.TypeError: Subscripted generics cannot be used with class and instance checks

https://github.com/crossbario/xbr-www/blob/ad2a7c0e5659d1af22d8232b5682d2557a7e32c4/backend/xbrnetwork/_api.py#L1095

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant