[Python-Dev] Patch review: [ 1098732 ] Enhance tracebacks and
stack traces with vars
Bob Ippolito
bob at redivi.com
Thu Feb 10 00:40:08 CET 2005
On Feb 9, 2005, at 6:25 PM, Michael Hudson wrote:
> "Phillip J. Eby" <pje at telecommunity.com> writes:
>
>> At 08:20 PM 2/9/05 +0100, BJörn Lindqvist wrote:
>>> Does Skip's idea have
>>> any merit?
>>
>> Yes, but not as a default behavior. Many people already consider the
>> fact that tracebacks display file paths to be a potential security
>> problem. If anything, the default traceback display should have less
>> information, not more. (E.g., display module __name__ instead of the
>> code's __file__).
>
> Oh, come on. Making tracebacks less useful to protect people who
> accidentally spray them across the internet seems absurd. Would you
> like them not to show source, either?
On Mac OS X the paths to the files are so long as to make the
tracebacks really ugly and *less* usable. I certainly wouldn't mind if
__name__ showed up instead of __file__. I have a "pywhich" script that
shows me the file given a name that I use:
(note that modulegraph.util.imp_find_module is like imp.find_module but
it will walk the packages to find the actual module and it only returns
the filename)
#!/usr/bin/env python
import sys, os
from modulegraph.util import imp_find_module
for module in sys.argv[1:]:
path,oext = os.path.splitext(imp_find_module(module)[1])
for ext in ('.py', oext):
if os.path.exists(path+ext):
print path+ext
break
-bob
More information about the Python-Dev
mailing list