diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2010-05-06 18:15:37 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2010-05-07 12:05:57 -0400 |
commit | a78f828cceab49038f4777dd85e2c898f86d51ab (patch) | |
tree | c093dc220e440e6ca971774ef4bd205fc65ba00c /giscanner/annotationparser.py | |
parent | 2f7066d7ba462641e1c5b6bc8d5fc5ee850ca87f (diff) | |
download | gobject-introspection-a78f828cceab49038f4777dd85e2c898f86d51ab.tar.gz |
Validate scope annotation values
Make sure that the value specified for scope in a callback
annotation is one of the legal values.
https://bugzilla.gnome.org/show_bug.cgi?id=617978
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r-- | giscanner/annotationparser.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 99da0bfe..5fa7cfc0 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -31,6 +31,9 @@ from .ast import (Array, Bitfield, Callback, Class, Enum, Field, Function, PARAM_DIRECTION_INOUT, PARAM_DIRECTION_IN, PARAM_DIRECTION_OUT, + PARAM_SCOPE_CALL, + PARAM_SCOPE_ASYNC, + PARAM_SCOPE_NOTIFIED, PARAM_TRANSFER_NONE, PARAM_TRANSFER_CONTAINER, PARAM_TRANSFER_FULL, @@ -526,6 +529,13 @@ class AnnotationApplier(object): scope = options.get(OPT_SCOPE) if scope: param.scope = scope.one() + if param.scope not in [PARAM_SCOPE_CALL, + PARAM_SCOPE_ASYNC, + PARAM_SCOPE_NOTIFIED]: + raise InvalidAnnotationError( + "scope for %s of %r is invalid (%r), must be one of " + "call, async, notified." + % (param.name, parent.name, param.scope)) param.transfer = PARAM_TRANSFER_NONE elif (param.type.ctype == 'GAsyncReadyCallback' or param.type.name == 'Gio.AsyncReadyCallback'): |