-
Notifications
You must be signed in to change notification settings - Fork 38
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
Semshi produces errors with __future__ annotations #116
Comments
The same bug occurs on Windows too, I tried commenting out the |
That's because Ubuntu 20.04 doesn't have Python 3.10. Nothing odd about it… |
@ObserverOfTime I switched from Python 3.10.1 to Python 3.7.9 on my Windows machine and now I can see the highlighting again. So what really happened here? Did Python 3.10 make shemshi buggy or something? |
I have not tried, but the interesting part is hidden by |
The from symtable import symtable
future = 'from __future__ import annotations\n'
code = 'ham: str = "ham"'
symtable(code, 'ham.py', 'exec').lookup('str') # works
symtable(future + code, 'ham.py', 'exec').lookup('str') # throws |
Yes, confirmed. Interestingly it also fails also only in the 2nd case with Python 3.11.0a4+ (44afdbd), although the future import is mandatory there according to https://docs.python.org/3.11/library/__future__.html. |
Considering this is intended behaviour, I don't think submitting an issue will change anything. |
Yeah, I've only figured out later that it might be intentional, which wasn't clear (to me) from the issue's title (https://bugs.python.org/issue42725). It is still not clear to me though, if not It is also suspicious that Python 3.11 without the future-annotation behaves differently (although it should be mandatory/enabled as per docs), but that might just not be the case already. |
So, is there any idea how to fix this? |
I committed a fix on a forked repo: https://github.com/aubustou/semshi |
I'm working on this to add PEP 563 support and fix the bug. If you're interested, please have a look at a PR wookayin#2 in my fork. UPDATE: Merged. |
Semshi is a great piece of code. It's very useful and helpful.
But, apparently, Semshi has issues with files containing the following
line:
When I edit a file containing the above line, I get the following
error message:
If I comment out the
__future__
line, the error messages go away.Alternatively, if I uninstall Semshi, Neovim runs without errors.
I'm running Semshi with the following:
Python 3.10.1
Neovim compiled from Github source.
Arch Linux 5.15.7-arch1-1
Dave
The text was updated successfully, but these errors were encountered: