[Stackless] You cannot __reduce__ the tasklet ...
Arman Bostani
arman at twinsun.com
Wed Jun 2 03:17:16 CEST 2004
I have the following simple example whereby function f() is attempting to save
a pickle of the current tasklet. As you can see from the run output, the
tasklet being pickled is neither "current" nor "main". So, either the
exception message is incorrect or there's a bug.
Regards,
-arman
######################################################################
from stackless import *
import cPickle
sattrs = 'is_current', 'is_main', 'prev', 'next', 'scheduled', 'alive'
def info(t):
print "Tasklet info:", t
for i in sattrs:
print '\t%s=%s' % (i, getattr(t, i))
def save(tg):
cPickle.dumps(tg)
def get_ct(last):
info(last)
last.remove()
info(last)
save(last)
def capture():
last = getcurrent()
ct = tasklet(get_ct)(last)
ct.run()
def f():
capture()
def run():
tasklet(f)().run()
######################################################################
RUN OUTPUT
######################################################################
Python 2.3.3 Stackless 3.0 040425 (#2, May 27 2004, 16:04:50)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from bug import *
>>> run()
Tasklet info: <stackless.tasklet object at 0x401e9144>
is_current=False
is_main=False
prev=<stackless.tasklet object at 0x401e917c>
next=<stackless.tasklet object at 0x401dbdbc>
scheduled=True
alive=True
Tasklet info: <stackless.tasklet object at 0x401e9144>
is_current=False
is_main=False
prev=None
next=None
scheduled=False
alive=True
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/export/home/arman/farm/arman2.3/medex/framework/junk3.py", line 29,
in run
tasklet(f)().run()
File "/export/home/arman/farm/arman2.3/medex/framework/junk3.py", line 18,
in get_ct
save(last)
File "/export/home/arman/farm/arman2.3/medex/framework/junk3.py", line 12,
in save
cPickle.dumps(tg)
RuntimeError: You cannot __reduce__ the tasklet which is current.
>>>
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list