diff options
author | Johan Dahlin <johan@src.gnome.org> | 2006-11-18 15:38:46 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2006-11-18 15:38:46 +0000 |
commit | 1063ecd1a4b51e259ef7ababb14d275a3debd021 (patch) | |
tree | e61399c878880e190e71c98079405c237e032ed5 | |
parent | dd9229fcc0ce1123e20f26804d147030cb268a13 (diff) | |
download | pygobject-1063ecd1a4b51e259ef7ababb14d275a3debd021.tar.gz pygobject-1063ecd1a4b51e259ef7ababb14d275a3debd021.tar.xz pygobject-1063ecd1a4b51e259ef7ababb14d275a3debd021.zip |
Make sure an exception is raised when we pass in invalid arguments to the
* gobject/pygoptiongroup.c (pyg_option_group_dealloc):
* tests/test_option.py (TestOption.testBadConstructor):
Make sure an exception is raised when we pass in invalid arguments
to the optiongroup constructor, add a test. #364576 (Laszlo Pandy)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | gobject/pygoptiongroup.c | 4 | ||||
-rw-r--r-- | tests/test_option.py | 5 |
3 files changed, 12 insertions, 4 deletions
@@ -1,7 +1,12 @@ 2006-11-18 Johan Dahlin <jdahlin@async.com.br> + * gobject/pygoptiongroup.c (pyg_option_group_dealloc): + * tests/test_option.py (TestOption.testBadConstructor): + Make sure an exception is raised when we pass in invalid arguments + to the optiongroup constructor, add a test. #364576 (Laszlo Pandy) + * gobject/pygobject.c (pygobject_register_class): set __module__ on - gobject derived types, fixes #376099 + gobject derived types, fixes #376099 (Osmo Salomaa) 2006-11-18 Yevgen Muntyan <muntyan@tamu.edu> diff --git a/gobject/pygoptiongroup.c b/gobject/pygoptiongroup.c index 4b284c6..09058d8 100644 --- a/gobject/pygoptiongroup.c +++ b/gobject/pygoptiongroup.c @@ -88,9 +88,9 @@ pyg_option_group_dealloc(PyGOptionGroup *self) if (!self->other_owner && !self->is_in_context) { GOptionGroup *tmp = self->group; - g_assert(tmp != NULL); self->group = NULL; - g_option_group_free(tmp); + if (tmp) + g_option_group_free(tmp); } PyObject_Del(self); diff --git a/tests/test_option.py b/tests/test_option.py index ace7bdb..84e9305 100644 --- a/tests/test_option.py +++ b/tests/test_option.py @@ -28,7 +28,7 @@ class TestOption(unittest.TestCase): parser.add_option("-t", "--test", help="Unit test option", action="store_false", dest="test", default=True) return parser - + def testOption(self): parser = self.setup_parser() group = self.setup_group() @@ -38,3 +38,6 @@ class TestOption(unittest.TestCase): assert group.values.test assert not parser.values.test assert group.values.unit_file == "test" + + def testBadConstructor(self): + self.assertRaises(TypeError, option.OptionGroup) |