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

Improve types for AST handling #2905

Merged
merged 3 commits into from
Aug 20, 2024
Merged

Conversation

JelleZijlstra
Copy link
Contributor

Adapting to changes in python/typeshed#11880. This mostly adds
more precise types for individual pieces of AST.

This change fixes typechecking issues that will show up when you next upgrade mypy.

@@ -815,13 +826,13 @@ def _join(parts: list[ast.AST]) -> ast.AST:
# bad line numbers cause an assert to fail in debug builds
for node in ast.walk(module):
if "lineno" in node._attributes:
node.lineno = 1
node.lineno = 1 # type: ignore[attr-defined]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These type ignores show up as unused right now with the current version of typeshed; I'll just remove them and they can be added when you pull in the new version of mypy.

@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 18, 2024 14:57
@davidism
Copy link
Member

Is this new mypy released yet? I just updated mypy to 1.10 and it seems to pass without this change, but perhaps it's not out yet.

@JelleZijlstra
Copy link
Contributor Author

It's not out, this is related to a typeshed PR that I merged earlier today. The relevant changes should be in the next mypy release.

@davidism davidism modified the milestones: 3.1.0, 3.0.4 Jul 31, 2024
JelleZijlstra and others added 3 commits August 20, 2024 09:11
Adapting to changes in python/typeshed#11880. This mostly adds
more precise types for individual pieces of AST.
@davidism davidism changed the base branch from main to 3.0.x August 20, 2024 16:11
@davidism davidism merged commit c3c82f4 into pallets:3.0.x Aug 20, 2024
12 checks passed
@JelleZijlstra JelleZijlstra deleted the ast-types branch August 20, 2024 16:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants