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

Narrow AST parsing result type to ast.Module at all times #116

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

bswck
Copy link
Contributor

@bswck bswck commented Dec 15, 2024

According to this overload of ast.parse for Python versions less than 3.13 and this overload of ast.parse for Python versions greater or equal to 3.13, parse_stub_file can only return ast.Module because the default value of the mode param in ast.parse is "exec" and parse_stub_file doesn't explicitly specify the argument for mode. Consequently, get_stub_ast can only return ast.Module or None.

@JelleZijlstra JelleZijlstra merged commit ed41f9a into JelleZijlstra:master Dec 16, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants