summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2020-03-14 06:59:27 (GMT)
committerGitHub <noreply@github.com>2020-03-14 06:59:27 (GMT)
commit3a8c56295d6272ad2177d2de8af4c3f824f3ef92 (patch)
tree9f4d7a615bd78987c6d36ee3ab7e084ee8ee1bc1 /Objects
parent7a5cbc72988aee668816be9d1ef44c0cb4081ff6 (diff)
downloadcpython-3a8c56295d6272ad2177d2de8af4c3f824f3ef92.zip
cpython-3a8c56295d6272ad2177d2de8af4c3f824f3ef92.tar.gz
cpython-3a8c56295d6272ad2177d2de8af4c3f824f3ef92.tar.bz2
Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer()" (GH-18985)
* Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)" This reverts commit c7ad974d341d3edb6b9d2a2dcae4d3d4794ada6b. * Update unicodeobject.h
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 0fea435..3d99f11 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3991,41 +3991,6 @@ PyUnicode_FSDecoder(PyObject* arg, void* addr)
}
-int
-_PyUnicode_GetUTF8Buffer(PyObject *unicode, const char *errors,
- Py_buffer *view)
-{
- if (!PyUnicode_Check(unicode)) {
- PyErr_BadArgument();
- return -1;
- }
- if (PyUnicode_READY(unicode) == -1) {
- return -1;
- }
-
- if (PyUnicode_UTF8(unicode) != NULL
- && Py_TYPE(unicode)->tp_as_buffer == NULL) {
- return PyBuffer_FillInfo(view, unicode,
- PyUnicode_UTF8(unicode),
- PyUnicode_UTF8_LENGTH(unicode),
- /* readonly */ 1, PyBUF_SIMPLE);
- }
-
- // Unlike PyUnicode_AsUTF8AndSize(), this function doesn't
- // create a UTF-8 cache for speed and efficiency.
- PyObject *bytes = _PyUnicode_AsUTF8String(unicode, errors);
- if (bytes == NULL) {
- return -1;
- }
- assert(PyBytes_CheckExact(bytes));
- if (PyObject_GetBuffer(bytes, view, PyBUF_SIMPLE) < 0) {
- Py_DECREF(bytes);
- return -1;
- }
- return 0;
-}
-
-
static int unicode_fill_utf8(PyObject *unicode);
const char *