[issue9317] Incorrect coverage file from trace test_pickle.py

2016-04-21 Thread Berker Peksag
Berker Peksag added the comment: A patch similar to issue9317.2.patch has been applied in 0aa46b9ffba3. However, I noticed a regression and created issue 26818. I can confirm that this issue is fixed with the patch from issue 26818 applied. -- nosy: +berker.peksag resolution: ->

[issue9317] Incorrect coverage file from trace test_pickle.py

2013-10-08 Thread Eli Bendersky
Changes by Eli Bendersky eli...@gmail.com: -- nosy: -eli.bendersky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9317 ___ ___ Python-bugs-list

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-10-15 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I have verified that the original issue is still present. I will try to narrow it down to a smaller test case. -- ___ Python tracker rep...@bugs.python.org

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-10-15 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I have found the cause of at least part of the issue. Apparently, module level statements for some of the modules such as pickle do not show up in trace because they are imported by trace itself. In other words, by the

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Eli Bendersky
Eli Bendersky eli...@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

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky alexander.belopol...@gmail.com added the comment: Eli, Your new patch makes perfect sense, but can you check of regular python invocation uses runpy these days. If it does, it may make sense to include it in trace at least optionally. Also, does this fix the original

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: Your new patch makes perfect sense, but can you check of regular python invocation uses runpy these days. If it does, it may make sense to include it in trace at least optionally. I'm not sure I understand what you mean by this. Could you

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky alexander.belopol...@gmail.com added the comment: On Jul 21, 2010, at 9:22 AM, Eli Bendersky rep...@bugs.python.org wrote: Eli Bendersky eli...@gmail.com added the comment: Your new patch makes perfect sense, but can you check of regular python invocation uses

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Eli Bendersky
Eli Bendersky eli...@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

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky alexander.belopol...@gmail.com added the comment: On Wed, Jul 21, 2010 at 9:45 AM, Eli Bendersky rep...@bugs.python.org wrote: .. 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.

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Eli, At this point, I think it will be best to focus on unittests. I am adding #9315 as a dependency here and will add a comment there. I think once we have good unittest coverage the bug will become obvious.

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Also, when you get a chance, please separate the __main__ coverage bug into a separate issue and bring it up on python-dev. We should get profile guys involved and I don't want them to be distracted by trace specific

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: 1. I've created Issue 9323 to address the bug with __main__, with the proposed patch. 2. Agreed about the unit tests (Issue 9315). I'll try to get the basic testing framework for trace.py created over the weekend. --

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
New submission from Alexander Belopolsky belopol...@users.sourceforge.net: I am running the following command $ python -m trace -C pickle-trace.d -c -m Lib/test/test_pickle.py and getting attached file, pickle.cover, in the pickle-trace.d directory. This does not look right. From the very

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: -- nosy: +eli.bendersky, tjreedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9317 ___

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Does the trace module even work in 3.x? I created attached trivial traceme.py file. With python 2.7, I get $ python2 -m trace -c -s traceme.py lines cov% module (path) 1 100% threading (Lib/threading.py)

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: Even the following simple test file: -- import pickle data = {'a' : [1, 2, 3], 'b': 5} ps = pickle.dumps(data) newdata = pickle.loads(ps) print(newdata) -- When traced generates an empty trace file for

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: I didn't hit refresh before posting so didn't see your message, Alexander. The problem indeed seems to be deeper. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9317

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Tue, Jul 20, 2010 at 11:28 PM, Eli Bendersky rep...@bugs.python.org wrote: The problem indeed seems to be deeper. .. or shallower. :-) -- ___ Python tracker

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Here is another problem: with no file x in cwd, $ ./python.exe -m trace -c -f x traceme.py Skipping counts file 'x': [Errno 2] No such file or directory: 'x' This one seems to exist in both 2.7 and 3.x. Creating empty

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Comparison of count files produced by 2.7 and 3.x suggests that the problem is in finding the source file for the module: pickle.load(open('x', 'rb')) ({('string', 2): 2, ('string', 1): 4, ('string', 8): 20, ..

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: trace.py uses settrace to do its heavy lifting. In the local trace function for counting, localtrace_count: def localtrace_count(self, frame, why, arg): if why == line: filename = frame.f_code.co_filename

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Wed, Jul 21, 2010 at 12:13 AM, Eli Bendersky rep...@bugs.python.org wrote: .. I'm investigating further, but this may very well be caused by different behavior of `f_code.co_filename` between Python 2 and 3. I am

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I am attaching a proof-of-concept patch, issue9317.diff, which fixes the file name problem at the expense of more spurious modules: $ ./python.exe -m trace -c -s traceme.py lines cov% module (path) 7 100%