[pypy-svn] r45033 - pypy/dist/pypy/lib/test2
tismer at codespeak.net
tismer at codespeak.net
Fri Jul 13 17:41:34 CEST 2007
Author: tismer
Date: Fri Jul 13 17:41:33 2007
New Revision: 45033
Added:
pypy/dist/pypy/lib/test2/test_stackless.py
Log:
stackless pickling is broken. This test breaks because we are pickling main via the parent. lib/stackless does not yet use usercostate. Also, pickling parent is generally a bad idea. I guess the parent must go away
Added: pypy/dist/pypy/lib/test2/test_stackless.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lib/test2/test_stackless.py Fri Jul 13 17:41:33 2007
@@ -0,0 +1,31 @@
+from pypy.conftest import gettestobjspace
+
+class AppTest_Stackless:
+
+ def setup_class(cls):
+ space = gettestobjspace(usemodules=('_stackless',))
+ cls.space = space
+
+ def test_pickle(self):
+ import pickle, sys
+ import stackless
+
+ ch = stackless.channel()
+
+ def recurs(depth, level=1):
+ print 'enter level %s%d' % (level*' ', level)
+ if level >= depth:
+ ch.send('hi')
+ if level < depth:
+ recurs(depth, level+1)
+ print 'leave level %s%d' % (level*' ', level)
+
+ def demo(depth):
+ t = stackless.tasklet(recurs)(depth)
+ print ch.receive()
+ blob = pickle.dumps(t)
+
+ t = stackless.tasklet(demo)(14)
+ stackless.run()
+
+# remark: think of fixing cells etc. on the sprint
More information about the Pypy-commit
mailing list