Issue #13748: Raw bytes literals can now be written with the rb prefix as well as br.

This commit is contained in:
Antoine Pitrou 2012-01-12 22:46:19 +01:00
parent b63a450cc4
commit 3a5d4cb940
6 changed files with 54 additions and 19 deletions

View file

@ -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 != '\"') {