[issue9317] Incorrect coverage file from trace test_pickle.py

Eli Bendersky report at bugs.python.org
Wed Jul 21 15:45:46 CEST 2010

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

> Sorry, typing on the phone.  s/of/if/ in my message above. What I mean
> is that as far as I know, when you run a script from command line,
> python loads it using functions in runpy.  Arguably this means that
> these functions should show up in coverage.

As far as I understand, when you run:

    py3d -m trace -C pickle-trace.d -c -m test_pickle.py

The first -m flag applies to the trace module. Python uses
runpy.run_module to load it, and then passes it its arguments (-C and

Since runpy.run_module actually runs /before/ trace.py, trace.py has
no chance of setting its settrace hooks and trace runpy itself.

Moreover, since runpy is only the machinery to execute trace.py, does
it even make sense to include it in coverage?

What do you think?


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list