-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Run mypy parser against a lot of Python code and file bugs for errors #487
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
Some issues I've found:
TODO: File the above as issues, or point to existing issues. |
I'll investigate the nested tuple lvalues issue. Apparently I overlooked something. |
Added open issue #494 for nonlocal support. EDIT: implemented (thanks @spkersten!) |
There already is the issue #460 for EDIT: implemented |
Also #60, relative imports. EDIT: implemented (thanks @mason-bially!) |
I'm having trouble reproducing the issue with nested tuple lvalues. When I try running mypy on profile.py, it complains it cannot find all kind of modules. |
profile.py now works for me as well. Odd. I'll try rerunning the whole thing and see if I misreported the issue. |
Complex literals was another missing missing feature (just pushed an implementation by @spkersten, thanks!). |
Another missing feature is yield expressions: #498 |
Mypy doesn't support the EDIT: implemented by @spkersten |
Calls such as Example in the wild: Python-3.2.3, EDIT: fixed |
Escapes within raw string literals are broken: #532 EDIT: fixed |
Another small parser problem: #533 EDIT: fixed |
0b int literals are not supported: #534 EDIT: fixed |
Misc parser issues:
|
Also: #573 |
Another parser bug ( EDIT: fixed |
Source file encodings aren't supported: #522 EDIT: fixed |
Another parses crash: #588 EDIT: fixed |
I'm currently working on a full reimplementation of the parser. Among other things, it will provide full support for 3.5 syntax (though not semanal). Matmul was easy, but async/await was a huge pain (blame @gvanrossum for accepting the PEP without requiring a Goals:
Work in progress: https://github.com/o11c/mypy/tree/syntax Current status:
|
@o11c That is interesting! I'm excited to see what the finished parser looks like. One important thing to keep in mind is that I don't want the lexer and parser to get significantly slower than they are currently (hopefully we can make them faster). Also, I tried to to run the lexer from the command line but I couldn't get it to work:
|
That exception is odd, the code should not allow it unless something has gone horribly wrong, I have tested the lexer (in tree mode, with 3.4 dialect selected) against all the I haven't measured, but the lexer (at least in non-tree mode) should almost certainly be faster, because it offloads the bulk of the work to a single call to the regular expression engine, which is implemented in C, instead of doing a lot of branches and function calls in python. There's still some room for improvement, especially for the super-evil The parser does have a disadvantage because the parse-tree stage will generate a lot of temporary objects (including for tokens like comma that were previously just dropped) that will be thrown away during the new "lowering" stage. But I expect the cost of semanal to dwarf the cost of parsing though so micro-optimizations for the intermediate parse objects aren't worth it. |
I think this issue has run its course. |
The mypy parser still doesn't support all of Python 3 syntax. Run the parser against a corpus of Python code and file tasks for any remaining parser issues. Note that there are open 2 pull requests that implement some new syntax (#367 and #483).
The text was updated successfully, but these errors were encountered: