Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 74354:bbed36370b08
Issue #13748: Raw bytes literals can now be written with the `rb` prefix as well as `br`.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 12 Jan 2012 22:46:19 +0100 |
| parents | 7109f31300fb |
| children | d64ac9ab4cd0 |
line wrap: on
line diff
--- a/Python/ast.c Thu Jan 12 22:38:13 2012 +0100 +++ b/Python/ast.c Thu Jan 12 22:46:19 2012 +0100 @@ -3744,13 +3744,18 @@ 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 != '\"') {
