Ned Batchelder <n...@nedbatchelder.com> added the comment:

This change seems like it has caused a problem.  Python trace functions behave 
as they did in Python 3.9, but C trace functions no longer get line numbers for 
call or return events.


Running this test code:

    def gen(inp):
        for n in inp:
            yield n

    list(gen([1,2,3]))

With my C trace function logging what it is passed, in Python 3.9 I got this:

    trace: CALL @ coverage_test_2616437928787223.py 1
    trace: LINE @ coverage_test_2616437928787223.py 1
    trace: LINE @ coverage_test_2616437928787223.py 5
    trace: CALL @ coverage_test_2616437928787223.py 1
    trace: LINE @ coverage_test_2616437928787223.py 2
    trace: LINE @ coverage_test_2616437928787223.py 3
    trace: RET  @ coverage_test_2616437928787223.py 3
    trace: CALL @ coverage_test_2616437928787223.py 3
    trace: LINE @ coverage_test_2616437928787223.py 2
    trace: LINE @ coverage_test_2616437928787223.py 3
    trace: RET  @ coverage_test_2616437928787223.py 3
    trace: CALL @ coverage_test_2616437928787223.py 3
    trace: LINE @ coverage_test_2616437928787223.py 2
    trace: LINE @ coverage_test_2616437928787223.py 3
    trace: RET  @ coverage_test_2616437928787223.py 3
    trace: CALL @ coverage_test_2616437928787223.py 3
    trace: LINE @ coverage_test_2616437928787223.py 2
    trace: RET  @ coverage_test_2616437928787223.py 2
    trace: RET  @ coverage_test_2616437928787223.py 5

With 3.10 (commit 1a9f51ed12feb4d95ad6d0faf610a030c05b9f5e) I get:

    trace: CALL @ coverage_test_40117094849631774.py 0
    trace: LINE @ coverage_test_40117094849631774.py 1
    trace: LINE @ coverage_test_40117094849631774.py 5
    trace: CALL @ coverage_test_40117094849631774.py 0
    trace: LINE @ coverage_test_40117094849631774.py 2
    trace: LINE @ coverage_test_40117094849631774.py 3
    trace: RET  @ coverage_test_40117094849631774.py 0
    trace: CALL @ coverage_test_40117094849631774.py 0
    trace: LINE @ coverage_test_40117094849631774.py 2
    trace: LINE @ coverage_test_40117094849631774.py 3
    trace: RET  @ coverage_test_40117094849631774.py 0
    trace: CALL @ coverage_test_40117094849631774.py 0
    trace: LINE @ coverage_test_40117094849631774.py 2
    trace: LINE @ coverage_test_40117094849631774.py 3
    trace: RET  @ coverage_test_40117094849631774.py 0
    trace: CALL @ coverage_test_40117094849631774.py 0
    trace: LINE @ coverage_test_40117094849631774.py 2
    trace: RET  @ coverage_test_40117094849631774.py 0
    trace: RET  @ coverage_test_40117094849631774.py 0

All of the call and return events now get a frame with f_lineno == 0.

Python trace functions seem unaffected.

The C code producing this debug output is here: 
https://github.com/nedbat/coveragepy/blob/a498ebc28273fd21b6a047a173b2e4443b91f563/coverage/ctracer/tracer.c#L786-L813

----------
nosy: +nedbat
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42823>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to