This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients Alexander.Belopolsky, amaury.forgeotdarc, belopolsky, eli.bendersky, ezio.melotti, flox, georg.brandl, pitrou, teresap989, terry.reedy
Date 2010-09-15.17:30:55
SpamBayes Score 3.330669e-16
Marked as misclassified No
Message-id <1284571857.88.0.484713749188.issue9315@psf.upfronthosting.co.za>
In-reply-to
Content
I am attaching another test file, y.py, which shows that the cause of discrepancy is outside of the trace module. The traced function is the same as in x.py only with 5 iterations instead of 10 for brevity, but instead of using trace module, I am registering a custom trace function like this:

lines =	[]
def tracefunc(frame, what, arg):
    if what == 'line':
	lines.append(frame.f_lineno)
    return tracefunc
sys.settrace(tracefunc)

3.1s: [3, 5, 3]
3.1g: [3, 5, 3, 4, 4, 4, 4, 4]
3.2s: [3, 5, 3, 3, 3, 3, 3, 3]
3.2g: [3, 5, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3]

Interestingly, this shows that effect of computed gotos is the same in 3.1 and 3.2 - adding a line event from "for i" line.

This situation illustrates the reason why I wanted to use synthetic events to test the trace module rather than events generated by settrace  machinery.  Apparently these differences have nothing to do with trace.py and everything with ceval.c.  If it is important to maintain stability of trace events between python versions, tests (with appropriate sensitivity) should be added to test_sys_setrace.

On the other hand, there are a lot of things that can go wrong in trace.py - extracting code information from frame, divining the method and class names etc.  Ideally, this logic should be tested without reliance on details of event generation.
History
Date User Action Args
2010-09-15 17:30:58belopolskysetrecipients: + belopolsky, georg.brandl, terry.reedy, amaury.forgeotdarc, pitrou, ezio.melotti, eli.bendersky, flox, Alexander.Belopolsky, teresap989
2010-09-15 17:30:57belopolskysetmessageid: <1284571857.88.0.484713749188.issue9315@psf.upfronthosting.co.za>
2010-09-15 17:30:56belopolskylinkissue9315 messages
2010-09-15 17:30:55belopolskycreate