[pypy-svn] r40113 - in pypy/dist/pypy/lib/distributed: . test

ac at codespeak.net ac at codespeak.net
Fri Mar 9 15:54:25 CET 2007


Author: ac
Date: Fri Mar  9 15:54:23 2007
New Revision: 40113

Modified:
   pypy/dist/pypy/lib/distributed/protocol.py
   pypy/dist/pypy/lib/distributed/test/test_distributed.py
Log:
Fix for bound methods of objects that are 'False'.



Modified: pypy/dist/pypy/lib/distributed/protocol.py
==============================================================================
--- pypy/dist/pypy/lib/distributed/protocol.py	(original)
+++ pypy/dist/pypy/lib/distributed/protocol.py	Fri Mar  9 15:54:23 2007
@@ -183,8 +183,8 @@
             tp = self.unwrap(w_class)
             name = self.unwrap(w_name)
             self_ = self.unwrap(w_self)
-            if self_:
-                if not tp:
+            if self_ is not None:
+                if tp is None:
                     setattr(self_, name, classmethod(self.unwrap(w_func)))
                     return getattr(self_, name)
                 return getattr(tp, name).__get__(self_, tp)

Modified: pypy/dist/pypy/lib/distributed/test/test_distributed.py
==============================================================================
--- pypy/dist/pypy/lib/distributed/test/test_distributed.py	(original)
+++ pypy/dist/pypy/lib/distributed/test/test_distributed.py	Fri Mar  9 15:54:23 2007
@@ -30,6 +30,13 @@
         
         assert type(protocol.unwrap(protocol.wrap(f))) is type(f)
 
+    def test_method_of_false_obj(self):
+        from distributed.protocol import AbstractProtocol
+        protocol = AbstractProtocol()
+        lst = []
+        m = lst.append
+        assert type(protocol.unwrap(protocol.wrap(m))) is type(m)
+
     def test_protocol_run(self):
         l = [1,2,3]
         from distributed.protocol import LocalProtocol



More information about the Pypy-commit mailing list