[Stackless] Debugging Tasklets
Richard Tew
richard.m.tew at gmail.com
Mon May 26 01:53:00 CEST 2008
On Sat, May 24, 2008 at 4:14 PM, Simon Pickles <sipickles at googlemail.com> wrote:
> Richard Tew wrote:
>> On Sat, May 24, 2008 at 8:53 AM, Simon Pickles <sipickles at googlemail.com> wrote:
>> You could print a stacktrace of its call stack.
>
> I'd be interested in knowing how to do that....
>>> import stackless
>>> import traceback
>>> def f():
... while 1:
... print "loop"
... stackless.schedule()
...
>>> def g():
... try:
... f()
... except StandardError:
... print "--- stacktrace of tasklet ---"
... traceback.print_exc()
... print "--- done ---"
...
>>> t = stackless.tasklet(g)()
>>> t.run()
loop
>>> t.raise_exception(StandardError, "test")
--- stacktrace of tasklet ---
Traceback (most recent call last):
File "<stdin>", line 3, in g
File "<stdin>", line 4, in f
StandardError: test
--- done ---
>>>
Whether it is possible to print a stacktrace of a non-current tasklet,
I do not recall offhand and do not have the time to look into it at
this time.
Cheers,
Richard.
More information about the Stackless
mailing list