mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #13748: Raw bytes literals can now be written with the rb
prefix as well as br
.
This commit is contained in:
parent
b63a450cc4
commit
3a5d4cb940
6 changed files with 54 additions and 19 deletions
19
Python/ast.c
19
Python/ast.c
|
@ -3744,13 +3744,18 @@ parsestr(struct compiling *c, const node *n, int *bytesmode)
|
|||
int rawmode = 0;
|
||||
int need_encoding;
|
||||
if (isalpha(quote)) {
|
||||
if (quote == 'b' || quote == 'B') {
|
||||
quote = *++s;
|
||||
*bytesmode = 1;
|
||||
}
|
||||
if (quote == 'r' || quote == 'R') {
|
||||
quote = *++s;
|
||||
rawmode = 1;
|
||||
while (!*bytesmode || !rawmode) {
|
||||
if (quote == 'b' || quote == 'B') {
|
||||
quote = *++s;
|
||||
*bytesmode = 1;
|
||||
}
|
||||
else if (quote == 'r' || quote == 'R') {
|
||||
quote = *++s;
|
||||
rawmode = 1;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quote != '\'' && quote != '\"') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue