[Python-Dev] seeing off SET_LINENO

M.-A. Lemburg mal@lemburg.com
Tue, 30 Jul 2002 14:42:19 +0200


Michael Hudson wrote:
> barry@python.org (Barry A. Warsaw) writes:
> 
> 
>>>>>>>"MH" == Michael Hudson <mwh@python.net> writes:
>>>>>>
>>    MH> 3) The patch changes behaviour -- for the better!  You're now
>>    MH> rather less likely to get the trace function called several
>>    MH> times per line.
>>
>>Does this change affect debugging?
> 
> 
> Hmm, I hadn't actually dared to run pdb with my patch... have now, and
> it seems OK.
> 
> There is a difference:
> 
> The bytecode for, say,
> 
> def f():
>     print 1
> 
> begins with two SET_LINENO's.  One is for the line containing "def
> f():", one is for "print 1".  My patch means the debugger doesn't stop
> on the "def f():" line -- unsurprisingly, given that no execution ever
> takes place on that line.

This might be used in debugging application to setup some
environment *before* diving into the function itself.

Note that many C debuggers stop at the declare line of
a function as well (because they execute stack setup code),
so a sudden change in this would probably confuse users of
todays Python IDEs.

> It would be possible to force a call to the trace function on entry to
> the function.  In fact, there's a commented out block for this in my
> patch.  Another approach would presuambly be for pdb to stop on 'call'
> trace events as well as 'line' ones.  I don't really understand, or
> use all that often, pdb.
> 
> Also, you currently stop twice on the first line of a for loop, but
> only once with my patch.  There are probably other situations of
> excessive SET_LINENO emission.  I know Skip (think it was him) killed
> a couple last week.  Bug compatibility is possible here too, but I
> don't see the advantage.
> 
> 
>>Have you tested how this change might interact with e.g. hotshot?
> 
> 
> test_hotshot was very important to me as evidence I was making
> progress!
> 
> It currently fails due to the not-calling-trace-on-def-line issue, but
> as I said, I think this is a *good* thing...

Have you also tested this with the commonly used Python IDEs
out there ? E.g. IDLE, IDLE-fork, PythonWorks, WingIDE, Emacs,
BlackAdder, BOA Constructor, etc. etc.



-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/