mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Remove support for u"..." literals.
This commit is contained in:
parent
0ac30f82fe
commit
bdde01168f
1 changed files with 1 additions and 10 deletions
11
Python/ast.c
11
Python/ast.c
|
@ -3139,13 +3139,8 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
|
||||||
int quote = Py_CHARMASK(*s);
|
int quote = Py_CHARMASK(*s);
|
||||||
int rawmode = 0;
|
int rawmode = 0;
|
||||||
int need_encoding;
|
int need_encoding;
|
||||||
int unicode = 0;
|
|
||||||
|
|
||||||
if (isalpha(quote) || quote == '_') {
|
if (isalpha(quote) || quote == '_') {
|
||||||
if (quote == 'u' || quote == 'U') {
|
|
||||||
quote = *++s;
|
|
||||||
unicode = 1;
|
|
||||||
}
|
|
||||||
if (quote == 'b' || quote == 'B') {
|
if (quote == 'b' || quote == 'B') {
|
||||||
quote = *++s;
|
quote = *++s;
|
||||||
*bytesmode = 1;
|
*bytesmode = 1;
|
||||||
|
@ -3159,10 +3154,6 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
|
||||||
PyErr_BadInternalCall();
|
PyErr_BadInternalCall();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (unicode && *bytesmode) {
|
|
||||||
ast_error(n, "string cannot be both bytes and unicode");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
s++;
|
s++;
|
||||||
len = strlen(s);
|
len = strlen(s);
|
||||||
if (len > INT_MAX) {
|
if (len > INT_MAX) {
|
||||||
|
@ -3212,7 +3203,7 @@ parsestr(const node *n, const char *encoding, int *bytesmode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PyString_DecodeEscape(s, len, NULL, unicode,
|
return PyString_DecodeEscape(s, len, NULL, 1,
|
||||||
need_encoding ? encoding : NULL);
|
need_encoding ? encoding : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue