This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eli.bendersky
Recipients belopolsky, eli.bendersky, terry.reedy
Date 2010-07-21.04:13:20
SpamBayes Score 0.00010450558
Marked as misclassified No
Message-id <1279685603.48.0.352825379998.issue9317@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-07-21 04:13:24eli.benderskysetrecipients: + eli.bendersky, terry.reedy, belopolsky
2010-07-21 04:13:23eli.benderskysetmessageid: <1279685603.48.0.352825379998.issue9317@psf.upfronthosting.co.za>
2010-07-21 04:13:20eli.benderskylinkissue9317 messages
2010-07-21 04:13:20eli.benderskycreate