From 67cef371dc09d6eb4daaf04a2a7b8239f8936e4f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 24 Sep 2021 14:06:09 +0530 Subject: [PATCH] Allow writing bytes when sending escape code to child --- kitty/fast_data_types.pyi | 2 +- kitty/screen.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index 3830f9d72..3e2620249 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -993,7 +993,7 @@ class Screen: def resize(self, width: int, height: int) -> None: pass - def send_escape_code_to_child(self, code: int, text: str) -> bool: + def send_escape_code_to_child(self, code: int, text: Union[str, bytes]) -> bool: pass def reset_callbacks(self) -> None: diff --git a/kitty/screen.c b/kitty/screen.c index 9ed6852ca..0918b95b3 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -3235,7 +3235,8 @@ static PyObject* send_escape_code_to_child(Screen *self, PyObject *args) { int code; char *text; - if (!PyArg_ParseTuple(args, "is", &code, &text)) return NULL; + Py_ssize_t sz; + if (!PyArg_ParseTuple(args, "is#", &code, &text, &sz)) return NULL; if (write_escape_code_to_child(self, code, text)) Py_RETURN_TRUE; Py_RETURN_FALSE; }