summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-10-09 13:39:51 (GMT)
committerGitHub <noreply@github.com>2023-10-09 13:39:51 (GMT)
commit7bd560ce8de41e62230975c44fd7fbd189e8e858 (patch)
tree0d58bd28ecb0827591cf0c91a0a3cefc1de1926c /Objects/abstract.c
parentf4cb0d27cc08f490c42a22e646eb73cc7072d54a (diff)
downloadcpython-7bd560ce8de41e62230975c44fd7fbd189e8e858.zip
cpython-7bd560ce8de41e62230975c44fd7fbd189e8e858.tar.gz
cpython-7bd560ce8de41e62230975c44fd7fbd189e8e858.tar.bz2
gh-76785: Add SendChannel.send_buffer() (#110246)
(This is still a test module.)
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 55d3b3a..806ca65 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2,6 +2,7 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
+#include "pycore_pybuffer.h"
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate()
#include "pycore_object.h" // _Py_CheckSlotResult()
@@ -806,6 +807,27 @@ PyBuffer_Release(Py_buffer *view)
Py_DECREF(obj);
}
+static int
+_buffer_release_call(void *arg)
+{
+ PyBuffer_Release((Py_buffer *)arg);
+ return 0;
+}
+
+int
+_PyBuffer_ReleaseInInterpreter(PyInterpreterState *interp,
+ Py_buffer *view)
+{
+ return _Py_CallInInterpreter(interp, _buffer_release_call, view);
+}
+
+int
+_PyBuffer_ReleaseInInterpreterAndRawFree(PyInterpreterState *interp,
+ Py_buffer *view)
+{
+ return _Py_CallInInterpreterAndRawFree(interp, _buffer_release_call, view);
+}
+
PyObject *
PyObject_Format(PyObject *obj, PyObject *format_spec)
{