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

Invalid DebugText for source with leading whitespace #11337

Open
dhruvmanila opened this issue May 8, 2024 · 1 comment
Open

Invalid DebugText for source with leading whitespace #11337

dhruvmanila opened this issue May 8, 2024 · 1 comment
Labels
bug Something isn't working parser Related to the parser

Comments

@dhruvmanila
Copy link
Member

Given:

        
# ^^^^^^ trailing whitespace here
f"{x   =  }"

The parser produces the incorrect AST. This is because the Parser::src_text creates an offset which doesn't take whitespace into consideration.

https://play.ruff.rs/dbc4339d-c692-403e-9fbc-6a33ca1d299e

@dhruvmanila dhruvmanila added bug Something isn't working parser Related to the parser labels May 8, 2024
@dhruvmanila
Copy link
Member Author

This basically affects all nodes that uses src_text method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser Related to the parser
Projects
None yet
Development

No branches or pull requests

1 participant