[pygobject] Fix (out) arguments in callbacks



commit ecd235959317d39b6d598662c00829e0ec717b17
Author: Martin Pitt <martinpitt gnome org>
Date:   Thu Jan 10 16:42:46 2013 +0100

    Fix (out) arguments in callbacks
    
    Do not ignore the first argument in _pygi_closure_set_out_arguments().
    Presumably that has been done to skip over "self", but callbacks are not
    required to have a self argument. As self is never (out), we can safely include
    it in the loop.

 gi/pygi-closure.c |    2 +-
 tests/test_gi.py  |    4 ----
 2 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index ab78078..f2f21f0 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -411,7 +411,7 @@ _pygi_closure_set_out_arguments (GICallableInfo *callable_info,
 
     i_out_args = 0;
     n_args = g_callable_info_get_n_args (callable_info);
-    for (i = 1; i < n_args; i++) {
+    for (i = 0; i < n_args; i++) {
         GIArgInfo arg_info;
         g_callable_info_load_arg (callable_info, i, &arg_info);
         GITypeInfo type_info;
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 144fd91..30511d0 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1377,13 +1377,11 @@ class TestCallbacks(unittest.TestCase):
             return 5
         self.assertEqual(GIMarshallingTests.callback_return_value_only(cb), 5)
 
-    @unittest.expectedFailure
     def test_one_out_arg(self):
         def cb():
             return 5.5
         self.assertAlmostEqual(GIMarshallingTests.callback_one_out_parameter(cb), 5.5)
 
-    @unittest.expectedFailure
     def test_multiple_out_args(self):
         def cb():
             return (5.5, 42.0)
@@ -1391,7 +1389,6 @@ class TestCallbacks(unittest.TestCase):
         self.assertAlmostEqual(res[0], 5.5)
         self.assertAlmostEqual(res[1], 42.0)
 
-    @unittest.expectedFailure
     def test_return_and_one_out_arg(self):
         def cb():
             return (5, 42.0)
@@ -1399,7 +1396,6 @@ class TestCallbacks(unittest.TestCase):
         self.assertEqual(res[0], 5)
         self.assertAlmostEqual(res[1], 42.0)
 
-    @unittest.expectedFailure
     def test_return_and_multiple_out_arg(self):
         def cb():
             return (5, 42, -1000)



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