diff options
author | Christoph Reiter <creiter@src.gnome.org> | 2017-03-26 16:23:25 +0200 |
---|---|---|
committer | Christoph Reiter <creiter@src.gnome.org> | 2017-03-31 07:44:37 +0200 |
commit | 81625ce4c0164dcb3409471fc38168147af4026a (patch) | |
tree | f7d72b5752b8ed874cd746692591a805c45c7438 /tests/test_gobject.py | |
parent | b23dea0981ab5718cb26d3a9f4f7bf8f593ac343 (diff) | |
download | pygobject-81625ce4c0164dcb3409471fc38168147af4026a.tar.gz |
Raise RuntimeError in case an uninitilialized GObject.Object is marshaled
One common case where this can happen is when subclassing a GObject.Object
without chaining up __init__ and then calling a method.
https://bugzilla.gnome.org/show_bug.cgi?id=730908
Diffstat (limited to 'tests/test_gobject.py')
-rw-r--r-- | tests/test_gobject.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_gobject.py b/tests/test_gobject.py index 39a277b5..19ef03c0 100644 --- a/tests/test_gobject.py +++ b/tests/test_gobject.py @@ -16,6 +16,12 @@ import testhelper class TestGObjectAPI(unittest.TestCase): + + def test_call_method_uninitialized_instance(self): + obj = GObject.Object.__new__(GObject.Object) + with self.assertRaisesRegex(RuntimeError, '.*is not initialized'): + obj.notify("foo") + def test_gobject_inheritance(self): # GObject.Object is a class hierarchy as follows: # overrides.Object -> introspection.Object -> static.GObject |