[Stackless] Problem with stackless.frame.co_firstlineno

Christian Tismer tismer at stackless.com
Fri Mar 5 04:14:42 CET 2004

Tom Locke wrote:
> I just hit the following error
> in inspect.findsource line 435
> IndexError: list index out of range
>      432:         lnum = object.co_firstlineno - 1
>      433:         pat = re.compile(r'^(\s*def\s)|(.*\slambda(:|\s))')
>      434:         while lnum > 0:
>   -> 435:             if pat.match(lines[lnum]): break
>      436:             lnum = lnum - 1
>      437:         return lines, lnum
> My environment drops me into the debugger. The strange thing is I can go
> up the stack one level and call findsource() from the debugger prompt
> and it works fine.
> Some kind of race hazard?
> I haven't isolated code to reproduce this, but I should be able to.
> Any ideas?

Can you plese try to make sure which frame you are inspecting,
and, especially, whic is the type fo the frame?
I have the theory that you (or your tools) are touching a frame
that isn't meant to be seen at all, and I should either drop it
(by doing a harder implementation) or hide it, by modifying
the introspection features.
There are so-called C-frames in Stackless, which might not
support all of what is needed to support, so I'm open for
There is also a common frame, common to all tasklets in a
system threads, which handles the shut-down of a tasklet.
I might have to augment it with better introspection features,
or I might to really hide it, as a surrogate for the None
b_back values.

To be able to talk about your application, I really would
need to have your application. Your error messages don't
tell me anything, since I'm not used to inspect.findsource.

thanx - chris

Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list