From 719b8f40e337edf57c6993c725ab5e71e329bc58 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Fri, 11 Feb 2011 18:18:14 -0300 Subject: Raise error when slot argument is unknown. Instead of accepting it silently and generating potential segfault and undefined behavior, raise TypeError when the type of an argument is unknown to PySide type system. An example of such erratic behavior is in declarations like: @Slot def foo(self): Slots without arguments must be explicitly declared this way: @Slot() def foo(self): Reviewer: Marcelo Lira Reviewer: Hugo Lima --- tests/signals/decorators_test.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/signals') diff --git a/tests/signals/decorators_test.py b/tests/signals/decorators_test.py index c4497ab8c..b25e12994 100644 --- a/tests/signals/decorators_test.py +++ b/tests/signals/decorators_test.py @@ -56,5 +56,14 @@ class StaticMetaObjectTest(unittest.TestCase): m = mo.method(i) self.assertEqual(m.typeName(), "int") + +class SlotWithoutArgs(unittest.TestCase): + + def testError(self): + # It should be an error to call the slot without the + # arguments, as just @Slot would end up in a slot + # accepting argument functions + self.assertRaises(TypeError, Slot, lambda: 3) + if __name__ == '__main__': unittest.main() -- cgit v1.2.3