-
Notifications
You must be signed in to change notification settings - Fork 1.3k
TypeError: '|' not supported between instances of '_CallableGenericAlias' and 'NoneType' #5711
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
Comments
RustPython's typing.py is out of date by 5 minor versions or so (3.9 or 3.10 or something). #5590 should fix it, but there is some ast that needs to be updated as well. |
Thanks for the attention. I tested the #5590 branch, and still see this error. on ref:
which results in
Pulling in the latest Lib/typing.py and I see that RustPython does not yet implement |
Isn't Pattern::MatchOr for match statements (it's implemented now, as per #5628)? This is Disassembly
$ ./target/debug/rustpython -m dis tmp.py
1 0 LoadConst (0)
1 LoadConst (("Awaitable", "Callable"))
2 ImportName (0, collections.abc)
3 ImportFrom (1, Awaitable)
4 StoreLocal (1, Awaitable)
5 ImportFrom (2, Callable)
6 StoreLocal (2, Callable)
7 Pop
The main issue is that |
Seems to be a bigger issue, #3746 or similar needs to be merged for this to be fixed. |
Interesting. I'm not sure. I did a quick experiment of pulling in the very latest typing.py, and got an unimplemented exception for |
If on the new branch, I believe it wasn't rebased at that time, so the match statements upgrade wasn't there. I'll see if I can get the bigger issue fixed since it affects a lot of things. |
I think I could just patch this issue specifically, since it happens elsewhere. |
Feature
The following fails on rustpython but succeeds on cpython3.12
Python Documentation or reference to CPython source code
I'm not sure. I have tried comparing RustPython's typing.py to cpython's. There are differences in the treatment of Callable.
https://github.com/python/cpython/blob/main/Lib/typing.py
The text was updated successfully, but these errors were encountered: