Small fix to handle @attributes: .... (.....) as a parameter to a function
[gnome.gobject-introspection] / giscanner / annotationparser.py
index aa04ef4..c693a97 100644 (file)
@@ -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
@@ -751,7 +753,8 @@ class AnnotationApplier(object):
         if annos_tag is None:
             return
         for key, value in annos_tag.options.iteritems():
-            node.attributes.append((key, value.one()))
+            if value:
+                node.attributes.append((key, value.one()))
 
     def _parse_skip(self, node, block):
         if block is not None: