summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorGreg Price <gnprice@gmail.com>2019-09-12 11:12:22 -0700
committerBenjamin Peterson <benjamin@python.org>2019-09-12 19:12:22 +0100
commit3a4f66707e824ef3a8384827590ebaa6ca463dc0 (patch)
treeed74c3415de2582188da0fa52ac3a9ffb2ac4f63 /Include
parenta44f3dc21d8b59ceeffa7dd1d9a7c05ed6be3e04 (diff)
downloadcpython-git-3a4f66707e824ef3a8384827590ebaa6ca463dc0.tar.gz
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 commit 768921cf3 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 commit 572dbf8f1 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 commit 8d30cc014 aka v3.0a1~1031 . The function (PyBytes_DecodeEscape) is exposed in the API, but it's never been documented.
Diffstat (limited to 'Include')
-rw-r--r--Include/bytesobject.h4
-rw-r--r--Include/longobject.h2
2 files changed, 2 insertions, 4 deletions
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
index 3fde4a221f..fc9981e56d 100644
--- a/Include/bytesobject.h
+++ b/Include/bytesobject.h
@@ -77,9 +77,7 @@ PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
#ifndef Py_LIMITED_API
/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */
PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
- const char *, Py_ssize_t,
- const char *,
- const char **);
+ const char *, const char **);
#endif
/* Macro, trading safety for speed */
diff --git a/Include/longobject.h b/Include/longobject.h
index 1e7a58d994..87b4d017d3 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -74,7 +74,7 @@ PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *);
#endif
/* Used by Python/mystrtoul.c, _PyBytes_FromHex(),
- _PyBytes_DecodeEscapeRecode(), etc. */
+ _PyBytes_DecodeEscape(), etc. */
#ifndef Py_LIMITED_API
PyAPI_DATA(unsigned char) _PyLong_DigitValue[256];
#endif