From d46539dd8f3db516cfe74f9bdfa2d4743a372259 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Fri, 11 Jan 2002 20:56:56 +0000 Subject: removed debugging code I didn't mean to check in. 2002-01-11 Matt Wilson * gtk/gtk.override (_wrap_gtk_toolbar_insert_stock): removed debugging code I didn't mean to check in. * gobjectmodule.c (pyg_closure_new): use PyTuple_SetItem to build the tuple if extra_args isn't one. It's faster than using abstractions and clarifies ownership rules, so we always incref extra_args even if we're about to wrap it in a tuple. Fixes crashes when passing callback functions into GtkToolbar.{append_item,prepend_item,insert_item,insert_stock, append_element} --- gobject/gobjectmodule.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 9440915..2532709 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1094,12 +1094,11 @@ pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data) Py_INCREF(callback); ((PyGClosure *)closure)->callback = callback; if (extra_args && extra_args != Py_None) { + Py_INCREF(extra_args); if (!PyTuple_Check(extra_args)) { PyObject *tmp = PyTuple_New(1); - PySequence_SetItem(tmp, 0, extra_args); + PyTuple_SetItem(tmp, 0, extra_args); extra_args = tmp; - } else { - Py_INCREF(extra_args); } ((PyGClosure *)closure)->extra_args = extra_args; } -- cgit