summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-04-16 18:14:29 -0400
committerRyan Lortie <desrt@desrt.ca>2014-05-06 08:15:23 -0400
commit289e85c43b0bf5cd19d1c5a282ad2db7c5136c84 (patch)
tree8e134bd621e007b092296fc33cc4f566b7fbf386
parentf2858cff69da8bcd4cbe196ed3a2f20b93872ad4 (diff)
downloadgobject-introspection-289e85c43b0bf5cd19d1c5a282ad2db7c5136c84.tar.gz
giscanner: tweak GCancellable null special case
We treat GCancellable and GAsyncReadyCallback as if they were always tagged (allow-none) because these parameters universally allow %NULL to be given as a value when they appear as in parameters on functions. Unfortunately, the meaning of (allow-none) is different on out parameters. There it means that you can give %NULL to ignore the return value. Limit this special case to only in parameters. https://bugzilla.gnome.org/show_bug.cgi?id=660879
-rw-r--r--giscanner/maintransformer.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index d957a1f0..8fad0d70 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -582,8 +582,9 @@ class MainTransformer(object):
if ANN_ALLOW_NONE in annotations:
node.allow_none = True
- if (node.type.target_giname == 'Gio.AsyncReadyCallback' or
- node.type.target_giname == 'Gio.Cancellable'):
+ if (node.direction == ast.PARAM_DIRECTION_IN and
+ (node.type.target_giname == 'Gio.AsyncReadyCallback' or
+ node.type.target_giname == 'Gio.Cancellable')):
node.allow_none = True
if tag and tag.description: