mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Cut disused recode_encoding logic in _PyBytes_DecodeEscape. (GH-16013)
All call sites pass NULL for `recode_encoding`, so this path is completely untested. That's been true since before Python 3.0. It adds significant complexity to this logic, so it's best to take it out. All call sites now have a literal NULL, and that's been true since commit768921cf3
eliminated a conditional (`foo ? bar : NULL`) at the call site in Python/ast.c where we're parsing a bytes literal. But even before then, that condition `foo` had been a constant since unadorned string literals started meaning Unicode, in commit572dbf8f1
aka v3.0a1~1035 . The `unicode` parameter is already unused, so mark it as unused too. The code that acted on it was also taken out before Python 3.0, in commit8d30cc014
aka v3.0a1~1031 . The function (PyBytes_DecodeEscape) is exposed in the API, but it's never been documented.
This commit is contained in:
parent
a44f3dc21d
commit
3a4f66707e
4 changed files with 8 additions and 63 deletions
|
@ -4766,7 +4766,7 @@ decode_bytes_with_escapes(struct compiling *c, const node *n, const char *s,
|
|||
size_t len)
|
||||
{
|
||||
const char *first_invalid_escape;
|
||||
PyObject *result = _PyBytes_DecodeEscape(s, len, NULL, 0, NULL,
|
||||
PyObject *result = _PyBytes_DecodeEscape(s, len, NULL,
|
||||
&first_invalid_escape);
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue