-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
List and dict literals with explicit types not documented #1
Labels
Comments
Updated the language overview. |
JukkaL
added a commit
that referenced
this issue
Jul 24, 2014
Add support for modeling unary plus, including with respect to a custom __pos__
ichard26
added a commit
to ichard26/mypy
that referenced
this issue
Mar 17, 2023
Change how imports (not from imports!) are processed so they can be table-driven and compact. Here's how it works: Import nodes are divided in groups (in the prebuild visitor). Each group consists of consecutive Import nodes: import mod <| group python#1 import mod2 | def foo() -> None: import mod3 <- group python#2 import mod4 <- group python#3 Every time we encounter the first import of a group, build IR to call CPyImport_ImportMany() that will perform all of the group's imports in one go. Previously, each module would imported and placed in globals manually in IR, leading to some pretty verbose code. The other option to collect all imports and perform them all at once in the helper would remove even more ops, however, it's problematic for the same reasons from the previous commit (spoiler: it's not safe). Implementation notes: - I had to add support for loading the address of a static directly, so I shoehorned in LoadLiteral support for LoadAddress. - Unfortunately by replacing multiple nodes with a single function call at the IR level, the traceback line number is static. Even if an import several lines down a group fails, the line # of the first import in the group would be printed. To fix this, I had to make CPyImport_ImportMany() add the traceback entry itself on failure (instead of letting codegen handle it automatically). This is admittedly ugly.
ilevkivskyi
added a commit
that referenced
this issue
Aug 9, 2023
#15832) …5272)" This reverts commit 2aaeda4. <!-- If this pull request fixes an issue, add "Fixes #NNN" with the issue number. --> (Explain how this PR changes mypy.) <!-- Checklist: - Read the [Contributing Guidelines](https://github.com/python/mypy/blob/master/CONTRIBUTING.md) - Add tests for all changed behaviour. - If you can't add a test, please explain why and how you verified your changes work. - Make sure CI passes. - Please do not force push to the PR once it has been reviewed. -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The mypy language overview should mention list and dict literals with explicit types, for example:
The text was updated successfully, but these errors were encountered: