Fix internal error when trying to detect the start of a recursive traceback.

Fix #2486
This commit is contained in:
Bruno Oliveira
2017-06-09 18:47:07 -03:00
parent b2d7c26d80
commit 8bb589fc5d
3 changed files with 29 additions and 2 deletions

View File

@@ -640,8 +640,11 @@ class FormattedExcinfo(object):
).format(exc_type=type(e).__name__, exc_msg=safe_str(e), max_frames=max_frames, total=len(traceback))
traceback = traceback[:max_frames] + traceback[-max_frames:]
else:
extraline = "!!! Recursion detected (same locals & position)"
traceback = traceback[:recursionindex + 1]
if recursionindex is not None:
extraline = "!!! Recursion detected (same locals & position)"
traceback = traceback[:recursionindex + 1]
else:
extraline = None
return traceback, extraline