Minimal debug/rep functionality

Delaney, Timothy tdelaney at
Sun Sep 22 19:51:15 EDT 2002

> From: richie at [mailto:richie at]
> The first version used the AST, but there are several holes in that -
> 'else' lines, for instance, are identified by the parser as executable
> lines, but the trace function doesn't always get called for them.

Something I would have had to find out myself ... thanks :)

> found out that SET_LINENO is going away in Python 2.3...

The reason I didn't do the same thing ...

> My current system (which I think works 8-) uses co_lnotab, which is a
> delightful data structure that describes the relationship between
> bytecodes and line numbers.  Here's the relevant piece of code, which
> builds in 'lineNumbers' a list of the execuable line number in the
> code object 'code':

Thank you. This should help immensely.

> Hope that helps.  The coverage tool that this belongs to is finished
> but unreleased (mostly because of lack of thorough testing, but I'm
> using it myself with no problems) - if you'd like a copy, drop me an
> email.

Please do - it will be interesting to see how our approaches differ. Don't
bother about tidying it up unless it's a real mess.

I'd better get onto asking my employer if I can pass this code onto other
people I guess :)

Tim Delaney

More information about the Python-list mailing list