Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bdde011

Browse files
committed
Remove support for u"..." literals.
1 parent 0ac30f8 commit bdde011

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

Python/ast.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,13 +3139,8 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
31393139
int quote = Py_CHARMASK(*s);
31403140
int rawmode = 0;
31413141
int need_encoding;
3142-
int unicode = 0;
31433142

31443143
if (isalpha(quote) || quote == '_') {
3145-
if (quote == 'u' || quote == 'U') {
3146-
quote = *++s;
3147-
unicode = 1;
3148-
}
31493144
if (quote == 'b' || quote == 'B') {
31503145
quote = *++s;
31513146
*bytesmode = 1;
@@ -3159,10 +3154,6 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
31593154
PyErr_BadInternalCall();
31603155
return NULL;
31613156
}
3162-
if (unicode && *bytesmode) {
3163-
ast_error(n, "string cannot be both bytes and unicode");
3164-
return NULL;
3165-
}
31663157
s++;
31673158
len = strlen(s);
31683159
if (len > INT_MAX) {
@@ -3212,7 +3203,7 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
32123203
}
32133204
}
32143205

3215-
return PyString_DecodeEscape(s, len, NULL, unicode,
3206+
return PyString_DecodeEscape(s, len, NULL, 1,
32163207
need_encoding ? encoding : NULL);
32173208
}
32183209

0 commit comments

Comments
 (0)