[svn r37348] Fallback

--HG--
branch : trunk
This commit is contained in:
fijal 2007-01-25 18:13:24 +01:00
parent e4044030b3
commit 0a9399329f
1 changed files with 7 additions and 4 deletions

View File

@ -34,10 +34,13 @@ class Outcome(object):
relline = lineno - tb_entry.frame.code.firstlineno
path = str(tb_entry.path)
#try:
if tb_style == 'long':
source = str(tb_entry.getsource())
else:
source = str(tb_entry.getsource()).split("\n")[relline]
try:
if tb_style == 'long':
source = str(tb_entry.getsource())
else:
source = str(tb_entry.getsource()).split("\n")[relline]
except py.error.ENOENT:
source = "[cannot get source]"
name = tb_entry.frame.code.raw.co_name
# XXX: Bare except. What can getsource() raise anyway?
# SyntaxError, AttributeError, IndentationError for sure, check it