mcst-linux-kernel/patches-2024.06.26/vte-0.28.2/0003-Upstream-Python-bindin...

99 lines
3.4 KiB
Diff
Raw Normal View History

2024-07-09 13:51:45 +03:00
From bd4c3b376b898ba17dca65cb7d9cb864598984e6 Mon Sep 17 00:00:00 2001
Date: Fri, 29 Sep 2017 15:33:15 +0300
Subject: [PATCH] Upstream Python bindings bugfix patch applied
Link: https://bugzilla.redhat.com/show_bug.cgi?id=556200
---
python/vte.override | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/python/vte.override b/python/vte.override
index 3f26f5a..311cd5a 100644
--- a/python/vte.override
+++ b/python/vte.override
@@ -306,9 +306,9 @@ call_callback(VteTerminal *terminal, glong column, glong row, gpointer data)
}
cb = PySequence_GetItem(data, 0); /* INCREFs */
- Py_XDECREF(cb);
if (!PyCallable_Check(cb)) {
+ Py_XDECREF(cb);
PyErr_SetString(PyExc_TypeError, "callback is not a callable object");
return FALSE;
}
@@ -320,6 +320,7 @@ call_callback(VteTerminal *terminal, glong column, glong row, gpointer data)
PyTuple_SetItem(args, 3, PySequence_GetItem(data, 2));
result = PyObject_CallObject(cb, args);
+ Py_XDECREF(cb);
Py_DECREF(args);
ret = (result && PyObject_IsTrue(result));
@@ -332,7 +333,7 @@ static PyObject*
build_attributes(GArray *attrs)
{
PyObject *py_attrs = PyTuple_New(attrs->len);
- int count;
+ guint count;
PyObject *row = PyString_FromString("row");
PyObject *column = PyString_FromString("column");
PyObject *fore = PyString_FromString("fore");
@@ -344,6 +345,8 @@ build_attributes(GArray *attrs)
VteCharAttributes *cht;
PyObject *py_char_attr;
+ cht = &g_array_index(attrs, VteCharAttributes, count);
+
py_char_attr = Py_BuildValue("{S:l,S:l,S:N,S:N,S:I,S:I}",
row, cht->row,
column, cht->column,
@@ -380,10 +383,9 @@ _wrap_vte_terminal_get_text(PyGObject *self, PyObject *args, PyObject *kwargs)
GArray *attrs = NULL;
char *text;
PyObject *py_attrs;
- int count;
long length;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:terminal_get_text",
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO:terminal_get_text",
kwlist, &callback, &do_attr, &data)) {
return NULL;
}
@@ -451,10 +453,9 @@ _wrap_vte_terminal_get_text_include_trailing_spaces(PyGObject *self, PyObject *a
GArray *attrs = NULL;
char *text;
PyObject *py_attrs;
- int count;
long length;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:terminal_get_text_include_trailing_spaces",
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO:terminal_get_text_include_trailing_spaces",
kwlist, &callback, &do_attr, &data)) {
return NULL;
}
@@ -522,11 +523,10 @@ _wrap_vte_terminal_get_text_range(PyGObject *self, PyObject *args, PyObject *kwa
GArray *attrs = NULL;
char *text;
PyObject *py_attrs;
- int count;
long length;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "llllO|OO:terminal_get_text_range",
+ "llll|OOO:terminal_get_text_range",
kwlist,
&start_row, &start_col, &end_row, &end_col,
&callback, &do_attr, &data)) {
@@ -641,7 +641,7 @@ _wrap_vte_terminal_match_check(PyGObject *self, PyObject *args, PyObject *kwargs
static char *kwlist[] = { "column", "row", NULL };
gchar *ret;
glong column, row;
- int *tag;
+ int tag;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ll:VteTerminal.match_check", kwlist, &column, &row))
return NULL;
--
2.16.4