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
            lineno = frame.f_lineno
            key = filename, lineno
            self.counts[key] = self.counts.get(key, 0) + 1
        return self.localtrace

The line "filename = frame.f_code.co_filename" seems to work as expected in 2.x 
for the current file, returning its name. In 3.x it returns '<string>' for the 
current file.

This causes the trace module to filter out the results for the current file 
(traceme.py in Alexander's example).

I'm investigating further, but this may very well be caused by different 
behavior of `f_code.co_filename` between Python 2 and 3.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9317>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to