[pypy-svn] r49658 - pypy/dist/pypy/lib/distributed

fijal at codespeak.net fijal at codespeak.net
Tue Dec 11 23:11:07 CET 2007


Author: fijal
Date: Tue Dec 11 23:11:06 2007
New Revision: 49658

Modified:
   pypy/dist/pypy/lib/distributed/faker.py
   pypy/dist/pypy/lib/distributed/protocol.py
Log:
Few fixes. Looks like cowboy coding to me, we need some serious descriptor
tests here.


Modified: pypy/dist/pypy/lib/distributed/faker.py
==============================================================================
--- pypy/dist/pypy/lib/distributed/faker.py	(original)
+++ pypy/dist/pypy/lib/distributed/faker.py	Tue Dec 11 23:11:06 2007
@@ -28,7 +28,7 @@
 
 from types import MethodType, FunctionType
 
-def ignore(name):
+def not_ignore(name):
     # we don't want to fake some default descriptors, because
     # they'll alter the way we set attributes
     l = ['__dict__', '__weakref__', '__class__', '__bases__',
@@ -43,14 +43,13 @@
     dict_w = {}
     for item in tp.__dict__.keys():
         value = getattr(tp, item)
-        if ignore(item):
+        if not_ignore(item):
             # we've got shortcut for method
             if hasattr(value, '__get__') and not type(value) is MethodType:
-                name = type(value).__name__
                 if hasattr(value, '__set__'):
-                    dict_w[item] = ('get', name)
+                    dict_w[item] = ('get', item)
                 else:
-                    dict_w[item] = ('set', name)
+                    dict_w[item] = ('set', item)
             else:
                 dict_w[item] = protocol.wrap(value)
     bases_w = [protocol.wrap(i) for i in tp.__bases__ if i is not object]

Modified: pypy/dist/pypy/lib/distributed/protocol.py
==============================================================================
--- pypy/dist/pypy/lib/distributed/protocol.py	(original)
+++ pypy/dist/pypy/lib/distributed/protocol.py	Tue Dec 11 23:11:06 2007
@@ -328,7 +328,12 @@
             name, w_obj, w_type = data
             obj = protocol.unwrap(w_obj)
             type_ = protocol.unwrap(w_type)
-            send(('finished', protocol.wrap(getattr(type(obj), name).__get__(obj, type_))))
+            if obj:
+                type__ = type(obj)
+            else:
+                type__ = type_
+            send(('finished', protocol.wrap(getattr(type__, name).__get__(obj, type_))))
+
         elif command == 'desc_set':
             name, w_obj, w_value = data
             obj = protocol.unwrap(w_obj)



More information about the Pypy-commit mailing list