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: ->
Changes by Eli Bendersky eli...@gmail.com:
--
nosy: -eli.bendersky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9317
___
___
Python-bugs-list
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
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
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
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
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
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
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
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.
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.
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
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.
--
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
Changes by Alexander Belopolsky belopol...@users.sourceforge.net:
--
nosy: +eli.bendersky, tjreedy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9317
___
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)
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
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
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
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
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, ..
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
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
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%
24 matches
Mail list logo