diff -ur vte-0.22.5-orig/python/vte.override vte-0.22.5-python-get-text/python/vte.override
--- vte-0.22.5-orig/python/vte.override	2010-01-16 20:54:40.515014436 -0500
+++ vte-0.22.5-python-get-text/python/vte.override	2010-01-16 22:14:40.881828300 -0500
@@ -306,9 +306,9 @@
     }
 
     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 @@
     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 @@
 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 @@
 	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 @@
     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 @@
     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 @@
     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 @@
     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;