[pygobject] Remove overzealous argument checking for callback userdata



commit 79aea2655db11bc9d2c0ad75c87862b2b66da594
Author: Simon Feltman <sfeltman src gnome org>
Date:   Mon Nov 4 03:29:57 2013 -0800

    Remove overzealous argument checking for callback userdata
    
    Remove check which ensures userdata is None if the callback is None.
    This check would need to become more complicated with recent versions of
    PyGObject where userdata can be variable (would also need to check against
    a tuple containing None). Instead of adding more complex checking, simply
    remove the checking as it is unnecessary to begin with.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711173

 gi/pygi-marshal-from-py.c   |    7 -------
 tests/test_overrides_gtk.py |   11 +++++++----
 2 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index 7bcba66..ed2e582 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -1367,13 +1367,6 @@ _pygi_marshal_from_py_interface_callback (PyGIInvokeState   *state,
         }
     }
 
-    if (py_arg == Py_None && !(py_user_data == Py_None || py_user_data == NULL)) {
-        PyErr_Format (PyExc_TypeError,
-                      "When passing None for a callback userdata must also be None");
-
-        return FALSE;
-    }
-
     if (py_arg == Py_None) {
         return TRUE;
     }
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index fd97908..fefc9a8 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -1565,10 +1565,13 @@ class TestTreeView(unittest.TestCase):
 
     def test_tree_view_column(self):
         cell = Gtk.CellRendererText()
-        Gtk.TreeViewColumn(title='This is just a test',
-                           cell_renderer=cell,
-                           text=0,
-                           style=2)
+        col = Gtk.TreeViewColumn(title='This is just a test',
+                                 cell_renderer=cell,
+                                 text=0,
+                                 style=2)
+
+        # Regression test for: https://bugzilla.gnome.org/show_bug.cgi?id=711173
+        col.set_cell_data_func(cell, None, None)
 
     def test_tree_view_add_column_with_attributes(self):
         model = Gtk.ListStore(str, str, str)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]