pygobject r942 - in trunk: . gobject tests
- From: paulp svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r942 - in trunk: . gobject tests
- Date: Mon, 11 Aug 2008 20:29:27 +0000 (UTC)
Author: paulp
Date: Mon Aug 11 20:29:27 2008
New Revision: 942
URL: http://svn.gnome.org/viewvc/pygobject?rev=942&view=rev
Log:
2008-08-11 Paul Pogonyshev <pogonyshev gmx net>
Bug 540376 â No TypeError raised when type is None
* gobject/gobjectmodule.c (pyg_signal_new): Add check on second
argument type.
* tests/test_signal.py (TestSignalCreation): New test case.
Modified:
trunk/ChangeLog
trunk/gobject/gobjectmodule.c
trunk/tests/test_signal.py
Modified: trunk/gobject/gobjectmodule.c
==============================================================================
--- trunk/gobject/gobjectmodule.c (original)
+++ trunk/gobject/gobjectmodule.c Mon Aug 11 20:29:27 2008
@@ -1314,12 +1314,20 @@
&py_type, &signal_flags, &py_return_type,
&py_param_types))
return NULL;
+
instance_type = pyg_type_from_object(py_type);
if (!instance_type)
return NULL;
+ if (!(G_TYPE_IS_INSTANTIATABLE(instance_type) || G_TYPE_IS_INTERFACE(instance_type))) {
+ PyErr_SetString(PyExc_TypeError,
+ "argument 2 must be an object type or interface type");
+ return NULL;
+ }
+
return_type = pyg_type_from_object(py_return_type);
if (!return_type)
return NULL;
+
if (!PySequence_Check(py_param_types)) {
PyErr_SetString(PyExc_TypeError,
"argument 5 must be a sequence of GType codes");
Modified: trunk/tests/test_signal.py
==============================================================================
--- trunk/tests/test_signal.py (original)
+++ trunk/tests/test_signal.py Mon Aug 11 20:29:27 2008
@@ -17,6 +17,16 @@
self.arg2 = arg2
C.do_my_signal(self, arg2)
+class TestSignalCreation(unittest.TestCase):
+ # Bug 540376.
+ def test_illegals(self):
+ self.assertRaises(TypeError, lambda: gobject.signal_new('test',
+ None,
+ 0,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_LONG,)))
+
+
class TestChaining(unittest.TestCase):
def setUp(self):
self.inst = C()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]