[gobject-introspection] [maintransformer] Make warning more robust



commit 2a70a474c2960496643cf5879158bea26c5648fa
Author: Johan Dahlin <johan gnome org>
Date:   Mon Sep 20 00:09:08 2010 -0300

    [maintransformer] Make warning more robust
    
    Instead of assuming that a parent node is always passed in,
    make sure to handle that case.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=629959

 giscanner/maintransformer.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index e069a2e..533db8f 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -285,10 +285,10 @@ usage is void (*_gtk_reserved1)(void);"""
 
         if not result.resolved:
             parent = orig_node
-            if isinstance(parent, ast.Function):
+            if parent is not None and isinstance(parent, ast.Function):
                 text = parent.symbol
             else:
-                text = parent.name
+                text = type_str
             message.warn_node(parent, "%s: Unknown type: %r" %
                               (text, result.ctype))
         return result



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