diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-12 21:46:19 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-12 21:46:19 (GMT) |
commit | 3a5d4cb940d9f06505b0b65916fd9a844bed13e3 (patch) | |
tree | 4f76dccee7b943c2d421442240892fe711401053 /Python/ast.c | |
parent | b63a450cc4c69c4e8668aa434a37b2aa213e94e0 (diff) | |
download | cpython-3a5d4cb940d9f06505b0b65916fd9a844bed13e3.zip cpython-3a5d4cb940d9f06505b0b65916fd9a844bed13e3.tar.gz cpython-3a5d4cb940d9f06505b0b65916fd9a844bed13e3.tar.bz2 |
Issue #13748: Raw bytes literals can now be written with the `rb` prefix as well as `br`.
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Python/ast.c b/Python/ast.c index 48aef48..110754b 100644 --- a/Python/ast.c +++ b/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 != '\"') { |