-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
NUL
character in f-strings (#7378)
## Summary This PR fixes the bug to allow `NUL` (`\0`) character inside f-strings. ## Test Plan Add test case with `NUL` character inside f-string.
- Loading branch information
1 parent
dcf6742
commit d01dbf5
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
..._python_parser/src/snapshots/ruff_python_parser__lexer__tests__fstring_with_nul_char.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
source: crates/ruff_python_parser/src/lexer.rs | ||
expression: lex_source(source) | ||
--- | ||
[ | ||
( | ||
FStringStart, | ||
0..2, | ||
), | ||
( | ||
FStringMiddle { | ||
value: "\\0", | ||
is_raw: false, | ||
}, | ||
2..4, | ||
), | ||
( | ||
FStringEnd, | ||
4..5, | ||
), | ||
( | ||
Newline, | ||
5..5, | ||
), | ||
] |