From 8650c801a26c14e3887c89c8bb2448b810c6cb32 Mon Sep 17 00:00:00 2001 From: hpk Date: Tue, 7 Oct 2008 17:44:56 +0200 Subject: [PATCH] [svn r58775] only check for Recursion if we have a RuntimeError --HG-- branch : trunk --- py/code/excinfo.py | 4 +++- py/code/testing/test_excinfo.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/py/code/excinfo.py b/py/code/excinfo.py index d38735a7b..e0ce0fe5f 100644 --- a/py/code/excinfo.py +++ b/py/code/excinfo.py @@ -194,7 +194,9 @@ class FormattedExcinfo(object): traceback = excinfo.traceback if self.tbfilter: traceback = traceback.filter() - recursionindex = traceback.recursionindex() + recursionindex = None + if excinfo.errisinstance(RuntimeError): + recursionindex = traceback.recursionindex() last = traceback[-1] entries = [] extraline = None diff --git a/py/code/testing/test_excinfo.py b/py/code/testing/test_excinfo.py index 5d82e60ab..f87cb87bb 100644 --- a/py/code/testing/test_excinfo.py +++ b/py/code/testing/test_excinfo.py @@ -351,6 +351,8 @@ raise ValueError() def exconly(self, tryshort): return "EXC" + def errisinstance(self, cls): + return False excinfo = FakeExcinfo() class FakeRawTB(object):