From 7cd74cb852c9029cbf98a537481f26fb4ace6323 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 13 Mar 2022 07:47:25 +0530 Subject: [PATCH] Allow writing memoryview to child --- kitty/child-monitor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index e844e0ed4..04959c57f 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -319,10 +319,10 @@ schedule_write_to_child_python(unsigned long id, const char *prefix, PyObject *a static PyObject * needs_write(ChildMonitor UNUSED *self, PyObject *args) { #define needs_write_doc "needs_write(id, data) -> Queue data to be written to child." - unsigned long id, sz; - const char *data; - if (!PyArg_ParseTuple(args, "ks#", &id, &data, &sz)) return NULL; - if (schedule_write_to_child(id, 1, data, (size_t)sz)) { Py_RETURN_TRUE; } + unsigned long id; + Py_buffer buf; + if (!PyArg_ParseTuple(args, "ky*", &id, &buf)) return NULL; + if (schedule_write_to_child(id, 1, buf.buf, (size_t)buf.len)) { Py_RETURN_TRUE; } Py_RETURN_FALSE; }