Richard Fish wrote:
> 
> Ok, here is my patch to fix this latest problem.

Er, I mean, HERE it is... ;)

-- 
Richard Fish                      Enhanced Software Technologies, Inc.
Software Developer                4014 E Broadway Rd Suite 405
[EMAIL PROTECTED]                    Phoenix, AZ  85040 
(602) 470-1115                    http://www.estinc.com
--- pygtk-SNAP-19990220/gtk.py  Sat Feb 20 07:40:13 1999
+++ pygtk-new/gtk.py    Sat Feb 20 13:57:14 1999
@@ -54,25 +54,26 @@
                else:
                        return cmp(id(self), id(other))
        def __getattr__(self, attr):
-               # this function allows setting attributes on an object so that
-               # they will always be available with the object.  Due to
-               # reference counting problems, we can't always pass the
-               # same GtkObject instance to a callback.
-               if attr[0] == '_' or not self.__dict__.has_key('_o'):
-                       raise AttributeError, attr
+               # this should only be called if the attr doesn't exist in
+               # self.__dict__.  Thus, try fetching the attribute from our
+               # dictionary of "shared" attributes stored with the object
+               if not self.__dict__.has_key('_o'):
+                       raise AttributeError, attr
                dict = self.get_data('Python-Attributes')
                if dict and dict.has_key(attr):
                        return dict[attr]
                raise AttributeError, attr
        def __setattr__(self, attr, value):
-               if attr[0] == '_' or self.__dict__.has_key(attr) or \
-                  not self.__dict__.has_key('_o'):
-                       self.__dict__[attr] = value
-               dict = self.get_data('Python-Attributes')
-               if not dict:
-                       dict = {}
-                       self.set_data('Python-Attributes', dict)
-               dict[attr] = value
+               # always set attr in self.__dict__.  Additionally, if _o
+                # is defined, set attr in the shared dictionary stored with
+               # the object
+               if (self.__dict__.has_key('_o')):
+                       dict = self.get_data('Python-Attributes')
+                       if not dict:
+                               dict = {}
+                               self.set_data('Python-Attributes', dict)
+                       dict[attr] = value
+               self.__dict__[attr] = value
        def __delattr__(self, attr):
                if self.__dict__.has_key(attr):
                        del self.__dict__[attr]

Reply via email to