From 37d357ff4ca83e8d52dea5f0766572ce72677fd9 Mon Sep 17 00:00:00 2001 From: fijal Date: Tue, 5 Feb 2008 15:35:49 +0100 Subject: [PATCH] [svn r51292] Just another except, in order to represent source when it's not there. --HG-- branch : trunk --- py/test/representation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/py/test/representation.py b/py/test/representation.py index 0b146795a..555abf227 100644 --- a/py/test/representation.py +++ b/py/test/representation.py @@ -71,8 +71,11 @@ class Presenter(object): s = str(source.getstatement(len(source)-1)) except KeyboardInterrupt: raise - except: - s = str(source[-1]) + except: + try: + s = str(source[-1]) + except IndexError: + s = "" indent = " " * (4 + (len(s) - len(s.lstrip()))) # get the real exception information out lines = excinfo.exconly(tryshort=True).split('\n')