[pypy-svn] r32640 - in pypy/dist/pypy/objspace/cclp: . constraint

auc at codespeak.net auc at codespeak.net
Mon Sep 25 19:07:23 CEST 2006


Author: auc
Date: Mon Sep 25 19:07:21 2006
New Revision: 32640

Modified:
   pypy/dist/pypy/objspace/cclp/constraint/distributor.py
   pypy/dist/pypy/objspace/cclp/constraint/domain.py
   pypy/dist/pypy/objspace/cclp/types.py
Log:
transl. fixes


Modified: pypy/dist/pypy/objspace/cclp/constraint/distributor.py
==============================================================================
--- pypy/dist/pypy/objspace/cclp/constraint/distributor.py	(original)
+++ pypy/dist/pypy/objspace/cclp/constraint/distributor.py	Mon Sep 25 19:07:21 2006
@@ -18,7 +18,9 @@
 
 def spawn_distributor(space, distributor):
     thread = ClonableCoroutine(space)
-    thread._cspace = ClonableCoroutine.w_getcurrent(space)._cspace
+    current = ClonableCoroutine.w_getcurrent(space)
+    assert hasattr(current, '_cspace')
+    thread._cspace = current._cspace
     thunk = DistributorThunk(space, distributor, thread)
     thread.bind(thunk)
     if not we_are_translated():
@@ -112,7 +114,7 @@
     if not isinstance(fanout, int):
         raise OperationError(object_space.w_RuntimeError,
                              object_space.wrap("fanout must be a positive integer"))
-    return object_space.wrap(W_NaiveDistributor(object_space, fanout))
+    return W_NaiveDistributor(object_space, fanout)
 app_make_naive_distributor = interp2app(make_naive_distributor,
                                         unwrap_spec = [baseobjspace.ObjSpace, int])
 

Modified: pypy/dist/pypy/objspace/cclp/constraint/domain.py
==============================================================================
--- pypy/dist/pypy/objspace/cclp/constraint/domain.py	(original)
+++ pypy/dist/pypy/objspace/cclp/constraint/domain.py	Mon Sep 25 19:07:21 2006
@@ -4,6 +4,7 @@
 from pypy.interpreter.gateway import interp2app
 
 from pypy.objspace.std.listobject import W_ListObject, W_TupleObject
+from pypy.objspace.std.intobject import W_IntObject
 
 from pypy.objspace.std.model import StdObjSpaceMultiMethod
 
@@ -89,7 +90,9 @@
 
     def size(self):
         """computes the size of a finite domain"""
-        return self._space.len(self._values).intval
+        l = self._space.len(self._values)
+        assert isinstance(l, W_IntObject)
+        return l.intval
     __len__ = size
     
     def w_get_values(self):

Modified: pypy/dist/pypy/objspace/cclp/types.py
==============================================================================
--- pypy/dist/pypy/objspace/cclp/types.py	(original)
+++ pypy/dist/pypy/objspace/cclp/types.py	Mon Sep 25 19:07:21 2006
@@ -42,7 +42,9 @@
         self.w_dom = w_dom
         self.name = space.str_w(w_name)
         self.w_nam = w_name
-        cspace = ClonableCoroutine.w_getcurrent(space)._cspace
+        current = ClonableCoroutine.w_getcurrent(space)
+        assert hasattr(current, '_cspace')
+        cspace = current._cspace
         if cspace is None:
             w("-- WARNING : you are instanciating a constraint var in the top-level space")
         else:



More information about the Pypy-commit mailing list