[Stackless] Debugging stackless applications

Richard Tew richard.m.tew at gmail.com
Wed Aug 15 13:35:55 CEST 2007

On 8/15/07, Rotem Yaari <vmalloc at gmail.com> wrote:
> try:
>     stackless.run()
> except Exception:
>     import pdb
>     pdb.pm()
> within pdb, I would like to see the current position of task1, which did not
> throw an exception, but did not terminate either.

I cannot answer in terms of certainties, as I do not have an
installation of Stackless Python to verify my answers with.  However,
I can give you some answers which you should be able to verify for

The debugger is not Stackless compatible.  And debugging hooks are
per-tasklet, so if you switch to another tasklet, the debugger will
stop running with the no longer scheduled tasklet it was run within.
You certainly cannot debug another tasklet from the main one, without
a debugger which is Stackless compatible.

I would also be surprised if uncaught exceptions in a tasklet were
raised in the main tasklet where the scheduler was run.  Even if they
are, if you invoke the debugger in the main tasklet, then the main
tasklet is what you are going to be debugging.

I suggest you use an idiom like the ones in the Micromanaging section
of this web page to catch exceptions which reach the top level of a

You can then invoke the debugger there, while the tasklet is still
running.  Although how useful it will be, given you cannot allow it to
switch, I do not know.

Again, this is unverified from memory.  But I hope it helps anyway.


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list