Bugs item #1690103, was opened at 2007-03-28 14:05 Message generated for change (Comment added) made by montanaro You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1690103&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Skip Montanaro (montanaro) Assigned to: Nobody/Anonymous (nobody) Summary: trace module borks __file__ Initial Comment: Stick this in a file (say, printfile.py): print __file__ If I run it as "python printfile.py" using Python 2.4, 2.5 or 2.6 it prints as expected, e.g.: % python ~/tmp/printfile.py /Users/skip/tmp/printfile.py If, however, I run it under control of the trace module I get something entirely different: % python -m trace --count ~/tmp/printfile.py /Users/skip/local/lib/python2.6/trace.py % python -m trace --trace ~/tmp/printfile.py --- modulename: threading, funcname: settrace threading.py(70): _trace_hook = func --- modulename: trace, funcname: <module> <string>(1): --- modulename: trace, funcname: <module> printfile.py(1): print __file__ /Users/skip/local/lib/python2.6/trace.py Definitely looks buggy to me... ---------------------------------------------------------------------- >Comment By: Skip Montanaro (montanaro) Date: 2007-03-28 15:38 Message: Logged In: YES user_id=44345 Originator: YES Hmmm... Maybe not so hard after all. See attached diff. Does anyone see a problem with simply overwriting the trace module's __file__ attribute? File Added: trace.diff ---------------------------------------------------------------------- Comment By: Skip Montanaro (montanaro) Date: 2007-03-28 15:01 Message: Logged In: YES user_id=44345 Originator: YES I believe this is because the trace module calls execfile() to run the file. I'm not sure if there's an easy fix for this problem. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1690103&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com