diff options
-rw-r--r-- | libpyside/pysideslot.cpp | 3 | ||||
-rw-r--r-- | tests/signals/decorators_test.py | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libpyside/pysideslot.cpp b/libpyside/pysideslot.cpp index 7d22ca9b0..28c6ed6a3 100644 --- a/libpyside/pysideslot.cpp +++ b/libpyside/pysideslot.cpp @@ -121,6 +121,9 @@ int slotTpInit(PyObject *self, PyObject *args, PyObject *kw) } else { data->args = typeName; } + } else { + PyErr_Format(PyExc_TypeError, "Unknown signal argument type: %s", argType->ob_type->tp_name); + return -1; } } 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() |