[pygobject] Don't call getattr again in gi.overrides.Gdk.Event.__getattr__



commit 204b45c7e95eb50d9e3843127fb10e13b1b17fee
Author: Simon van der Linden <svdlinden gnome org>
Date:   Sun Jan 2 19:25:55 2011 +0100

    Don't call getattr again in gi.overrides.Gdk.Event.__getattr__
    
    __getattr__ is only called when the attribute is not found through the normal
    mechanism, so getattr must not be called again in __getattr__ (which would
    create an infinite loop).
    
    Another possibility would be to implement __getattribute__ instead, which is
    called in place of the normal mechanism. In that case, calling getattr would be
    needed for normal attributes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=638523

 gi/overrides/Gdk.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index c59685a..624ff49 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -122,7 +122,7 @@ class Event(Gdk.Event):
         if real_event:
             return getattr(getattr(self, real_event), name)
         else:
-            return getattr(self, name)
+            raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__, name)
 
 Event = override(Event)
 __all__.append('Event')



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