diff options
author | Colin Walters <walters@verbum.org> | 2015-09-29 10:59:24 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2015-09-29 10:59:24 -0400 |
commit | 415895066f3395a4c6b6e7ab1cfe6674d962d469 (patch) | |
tree | 16da848cf3409c23d961b4eed60b381f53897970 /giscanner/maintransformer.py | |
parent | b13acd817835b57b24b11ce21551130166629cb9 (diff) | |
download | gobject-introspection-415895066f3395a4c6b6e7ab1cfe6674d962d469.tar.gz |
scanner: Explicitly error with constructors but no GObject include
One of the Anaconda developers hit this; the fix was to include
GObject, but without this commit we just traceback'd.
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r-- | giscanner/maintransformer.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 1b413ed8..2871abac 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -508,7 +508,11 @@ class MainTransformer(object): elif isinstance(parent, ast.Function) and parent.is_constructor: if isinstance(target, ast.Class): initially_unowned_type = ast.Type(target_giname='GObject.InitiallyUnowned') - initially_unowned = self._transformer.lookup_typenode(initially_unowned_type) + try: + initially_unowned = self._transformer.lookup_typenode(initially_unowned_type) + except KeyError as e: + message.error_node(node, "constructor found but GObject is not in includes") + return None if initially_unowned and self._is_gi_subclass(typeval, initially_unowned_type): return ast.PARAM_TRANSFER_NONE else: |