Commits

Lucian Brănescu-Mihăilă committed 32d91e7

Re-enable data descriptor in __setattr__.

  • Participants
  • Parent commits 166e96c

Comments (0)

Files changed (2)

File objects/src/type.winxed

     t.__str__ = t.__repr__;
 
     t.__getattribute__ = function(obj, key) {
-        cry('key: ' + key);
+        cry(key);
 
         var cls = obj.__dict__['__class__'];
         var chain = get_mro(cls);
     t.__setattr__ = function(obj, key, val) {
         var cls = obj.__dict__['__class__'];
         
-        /* disable data descriptors for now
         if(exists cls.__dict__[key]) {
             var attr = cls.__dict__[key];
 
-            if(exists attr.__dict__['__set__']) {
-                say('using data descriptor');
-                attr.__dict__['__set__'](attr, obj, val);
-                return;
-            }
+            // only for python objects
+            if(typeof(attr) == 'Python;instance')
+                if(exists attr.__dict__['__set__']) {
+                    say('using data descriptor');
+                    attr.__dict__['__set__'](attr, obj, val);
+                    return;
+                }
         }
-        */
 
         obj.__dict__[key] = val;
     };

File objects/t/typeobject.t

 
     function bases() {
         :(var t, var o) = boot();
-        for(var i in t.__dict__) say(i);
 
         self.assert.equal(o.__dict__['__bases__'], []);
         self.assert.equal(t.__dict__['__bases__'], [o]);
         :(var t, var o) = boot();
 
         using Python.get_mro;
-        //for(var i in get_mro(t)) say(string(i));
 
         self.assert.equal(get_mro(t), [t, o]);
         self.assert.equal(get_mro(o), [o]);