GNOME Bugzilla – Bug 690003
get_text method moved
Last modified: 2012-12-10 23:09:40 UTC
+++ This bug was initially created as a clone of Bug #676999 +++ Gonzalo Odiard 2012-12-10 19:44:09 UTC I have found two issues trying to use the get_text method in vte with python after apply this patch. The first is I can't set is_selected as None, the c code can manage it (vte.c line 6293) but the introspection annotations don't allow this. Can be solved doing: - * @is_selected: (scope call): a #VteSelectionFunc callback + * @is_selected: (scope call) (allow-none): a #VteSelectionFunc callback The second issue is more difficult to solve in a proper way: The attributes parameter is marked as: - * @attributes: (out) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes but if is a out parameter, I can't pass it as a parameter from python, and the first line using the parameter in the c code is: line 6298 if (attributes) g_array_set_size (attributes, 0); Then should be None or a already created GArray. Right now the application crash when I do: vte.get_text(None, None) The only workaround I have found is change: - * @attributes: (out) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes + * @attributes: (array) (element-type Vte.CharAttributes): location for storing text attributes and calling from python doing: vte.get_text(None, None, []) now the application don't crash, but of course the attributes array is not loaded. A test case is attached, and a diff to test these changes.
Colin, any idea re the out array issue?
(In reply to comment #1) > Colin, any idea re the out array issue? Try (out caller-allocates) instead of just (out). The latter is used when you return a new array container, i.e. GArray **.
Thanks. I assume (out caller-allocates) is consistent with (transfer full). Pushed both out. Closing, please reopen if issue persists.