summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2020-06-25 23:07:22 (GMT)
committerGitHub <noreply@github.com>2020-06-25 23:07:22 (GMT)
commit6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed (patch)
treeb5e8c8e1c6f671b1f39078d0a7dbce48fe307f25 /Objects/abstract.c
parent77ed29b2c2742b694cac6db5976afc31b58e4803 (diff)
downloadcpython-6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed.zip
cpython-6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed.tar.gz
cpython-6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed.tar.bz2
bpo-41103: Remove old buffer protocol support (#21117)
They are deprecated since Python 3.0.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index b9e7111..0d3f4ac 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -292,85 +292,6 @@ PyObject_CheckBuffer(PyObject *obj)
}
-/* We release the buffer right after use of this function which could
- cause issues later on. Don't use these functions in new code.
- */
-int
-PyObject_CheckReadBuffer(PyObject *obj)
-{
- PyBufferProcs *pb = Py_TYPE(obj)->tp_as_buffer;
- Py_buffer view;
-
- if (pb == NULL ||
- pb->bf_getbuffer == NULL)
- return 0;
- if ((*pb->bf_getbuffer)(obj, &view, PyBUF_SIMPLE) == -1) {
- PyErr_Clear();
- return 0;
- }
- PyBuffer_Release(&view);
- return 1;
-}
-
-static int
-as_read_buffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len)
-{
- Py_buffer view;
-
- if (obj == NULL || buffer == NULL || buffer_len == NULL) {
- null_error();
- return -1;
- }
- if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) != 0)
- return -1;
-
- *buffer = view.buf;
- *buffer_len = view.len;
- PyBuffer_Release(&view);
- return 0;
-}
-
-int
-PyObject_AsCharBuffer(PyObject *obj,
- const char **buffer,
- Py_ssize_t *buffer_len)
-{
- return as_read_buffer(obj, (const void **)buffer, buffer_len);
-}
-
-int PyObject_AsReadBuffer(PyObject *obj,
- const void **buffer,
- Py_ssize_t *buffer_len)
-{
- return as_read_buffer(obj, buffer, buffer_len);
-}
-
-int PyObject_AsWriteBuffer(PyObject *obj,
- void **buffer,
- Py_ssize_t *buffer_len)
-{
- PyBufferProcs *pb;
- Py_buffer view;
-
- if (obj == NULL || buffer == NULL || buffer_len == NULL) {
- null_error();
- return -1;
- }
- pb = Py_TYPE(obj)->tp_as_buffer;
- if (pb == NULL ||
- pb->bf_getbuffer == NULL ||
- ((*pb->bf_getbuffer)(obj, &view, PyBUF_WRITABLE) != 0)) {
- PyErr_SetString(PyExc_TypeError,
- "expected a writable bytes-like object");
- return -1;
- }
-
- *buffer = view.buf;
- *buffer_len = view.len;
- PyBuffer_Release(&view);
- return 0;
-}
-
/* Buffer C-API for Python 3.0 */
int