[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: -> fixed

[issue9317] Incorrect coverage file from trace test_pickle.py

2013-10-08 Thread Eli Bendersky
Changes by Eli Bendersky : -- nosy: -eli.bendersky ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-10-15 Thread Alexander Belopolsky
Alexander Belopolsky 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 time traced script gets executed

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-10-15 Thread Alexander Belopolsky
Alexander Belopolsky 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 ___

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Eli Bendersky
Eli Bendersky 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-21 Thread Alexander Belopolsky
Alexander Belopolsky 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 issues. -- ___

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky 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. -- dependencies: +The trace modul

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Wed, Jul 21, 2010 at 9:45 AM, Eli Bendersky 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. Python uses > runpy.run_module to load it, and

[issue9317] Incorrect coverage file from trace test_pickle.py

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

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Jul 21, 2010, at 9:22 AM, Eli Bendersky wrote: > > Eli Bendersky 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

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Eli Bendersky
Eli Bendersky 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 please cl

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky 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 problem? -- nosy: +Alex

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-21 Thread Eli Bendersky
Eli Bendersky 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 cod

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky 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% codecs (Lib/codecs.py) 10 1

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Wed, Jul 21, 2010 at 12:13 AM, Eli Bendersky 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 afraid I am a step ahead of you. The culprit is

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Eli Bendersky
Eli Bendersky 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 lineno = frame.f

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky 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')) ({('', 2): 2, ('', 1): 4, ('', 8): 20, .. >>> pickle.load(open('y', 'rb')) ({('traceme.py', 1): 2,

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky 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 counts file helps. -- __

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Tue, Jul 20, 2010 at 11:28 PM, Eli Bendersky 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 Eli Bendersky
Eli Bendersky 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 ___

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Eli Bendersky
Eli Bendersky 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 the pickle module,

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky 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) 6 100% traceme (tracem

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +eli.bendersky, tjreedy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue9317] Incorrect coverage file from trace test_pickle.py

2010-07-20 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : 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 beginning, module level statements