[pypy-svn] r31353 - in pypy/dist/pypy/objspace: cclp test
auc at codespeak.net
auc at codespeak.net
Wed Aug 16 18:48:49 CEST 2006
Author: auc
Date: Wed Aug 16 18:48:47 2006
New Revision: 31353
Modified:
pypy/dist/pypy/objspace/cclp/space.py
pypy/dist/pypy/objspace/cclp/thunk.py
pypy/dist/pypy/objspace/test/test_logicobjspace.py
Log:
fixes for fail, thunks -- can run a successful or failing relational program (still not non-deterministically)
Modified: pypy/dist/pypy/objspace/cclp/space.py
==============================================================================
--- pypy/dist/pypy/objspace/cclp/space.py (original)
+++ pypy/dist/pypy/objspace/cclp/space.py Wed Aug 16 18:48:47 2006
@@ -118,6 +118,8 @@
def fail(self):
self._failed = True
+ interp_bind(self._finished, True)
+ interp_bind(self._choice, self.space.newint(0))
self._store = {}
def w_merge(self):
Modified: pypy/dist/pypy/objspace/cclp/thunk.py
==============================================================================
--- pypy/dist/pypy/objspace/cclp/thunk.py (original)
+++ pypy/dist/pypy/objspace/cclp/thunk.py Wed Aug 16 18:48:47 2006
@@ -88,13 +88,14 @@
try:
_AppThunk.call(self)
except Exception, exc:
+ # maybe app_level sent something ...
w("-- exceptional EXIT of cspace", str(id(self._coro)), "with", str(exc))
- scheduler[0].dirty_traced_vars(self._coro, W_FailedValue(exc))
+ failed_value = W_FailedValue(exc)
+ scheduler[0].dirty_traced_vars(self._coro, failed_value)
self._coro._dead = True
if self.is_distributor():
cspace.fail()
- import traceback
- traceback.print_exc()
+ interp_bind(cspace._solution, failed_value)
else:
w("-- clean (valueless) EXIT of cspace", str(id(self._coro)))
interp_bind(cspace._solution, self.costate.w_tempval)
Modified: pypy/dist/pypy/objspace/test/test_logicobjspace.py
==============================================================================
--- pypy/dist/pypy/objspace/test/test_logicobjspace.py (original)
+++ pypy/dist/pypy/objspace/test/test_logicobjspace.py Wed Aug 16 18:48:47 2006
@@ -768,7 +768,7 @@
def test_tell_ask_choose_commit(self):
from problem import conference_scheduling
-
+
def solve(spc, commitment, Sol):
while 1:
status = spc.ask()
@@ -798,7 +798,6 @@
#assert len(sched_all()['threads']) == 1
def test_logic_program(self):
- skip("coming soon")
def soft():
choice = choose(2)
@@ -827,7 +826,6 @@
Shirt, Pants, Socks = newvar(), newvar(), newvar()
contrast(Shirt, Pants)
contrast(Pants, Socks)
- print Shirt, Socks, Pants
if Shirt == Socks: fail()
return (Shirt, Pants, Socks)
@@ -854,4 +852,4 @@
s = newspace(suit)
Solution = newvar()
stacklet(solve, s, commit_to(), Solution)
- print Solution
+ assert Solution in (False, ('beige', 'mauve', 'coral'))
More information about the Pypy-commit
mailing list