[gobject-introspection] giscanner: tweak GCancellable null special case



commit 289e85c43b0bf5cd19d1c5a282ad2db7c5136c84
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Apr 16 18:14:29 2014 -0400

    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

 giscanner/maintransformer.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index d957a1f..8fad0d7 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:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]