Assume allow-none for GCancellable
[gnome.gobject-introspection] / giscanner / annotationparser.py
index d91bb1c..fe5e721 100644 (file)
@@ -507,7 +507,7 @@ class AnnotationApplier(object):
 
     def _parse_param(self, parent, param, tag):
         options = getattr(tag, 'options', {})
-        if isinstance(parent, Function) and not param.scope:
+        if isinstance(parent, Function):
             scope = options.get(OPT_SCOPE)
             if scope:
                 param.scope = scope.one()
@@ -552,12 +552,14 @@ class AnnotationApplier(object):
         if node.direction is None:
             node.direction = self._guess_direction(node)
         node.transfer = self._extract_transfer(parent, node, options)
-        if OPT_ALLOW_NONE in options:
-            node.allow_none = True
         param_type = options.get(OPT_TYPE)
         if param_type:
             node.type = self._resolve(param_type.one(), node.type)
 
+        if (OPT_ALLOW_NONE in options or
+            node.type.ctype == 'GCancellable*'):
+            node.allow_none = True
+
         assert node.transfer is not None
         if tag is not None and tag.comment is not None:
             node.doc = tag.comment