[issue9317] Incorrect coverage file from trace test_pickle.py

Eli Bendersky report at bugs.python.org
Wed Jul 21 11:26:48 CEST 2010


Eli Bendersky <eliben at gmail.com> added the comment:

Alexander,

I propose an alternative patch (attached issue9317.2.diff). It uses:

            with open(progname) as fp:
                code = compile(fp.read(), progname, 'exec')
                t.run(code)

Since the `run` method of Trace already accepts a code object and passes it to `exec`, I see no reason to do another `exec`.

This also fixes your 'traceme' problem, without introducing new module imports:


$ py3d -m trace -c -s traceme.py 
lines   cov%   module   (path)
    1   100%   threading   (/home/eliben/python_src/eliben-py3k/Lib/threading.py)
    6   100%   traceme   (traceme.py)
[47526 refs]

----------
Added file: http://bugs.python.org/file18103/issue9317.2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9317>
_______________________________________


More information about the Python-bugs-list mailing list