-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
UP037 fix crashes when a terminal comment follows a literal #15816
Comments
Why is "contains a string or number literal" required? |
It looks like a bug with
and this is for the original example:
|
Not sure if that's a bug or the intended scope for In any event: we might be able to avoid tokenizing anything, I think, because the tokens for the annotation are available as
(not sure why there's a newline but otherwise looks correct) |
I think that's a logical newline: // https://github.com/astral-sh/ruff/blob/3125332ec1/crates/ruff_python_parser/src/token.rs#L130-L134
pub enum TokenKind {
// ...
/// Token kind for a newline.
Newline,
/// Token kind for a newline that is not a logical line break. These are filtered out of
/// the token stream prior to parsing.
NonLogicalNewline,
// ...
} |
Description
The fix for
quoted-annotation
(UP037) crashes Ruff 0.9.3 when a quoted annotation ends with a comment and contains a string or number literal, which can occur withAnnotated
orLiteral
.The text was updated successfully, but these errors were encountered: