From a050171ee9e44697260cd5415310777dadb5555e Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 15 Jun 2004 11:22:53 +0000 Subject: SF bug #973092: inspect.getframeinfo bug if 'context' is to big Make sure the start argument is not negative. --- Lib/inspect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/inspect.py b/Lib/inspect.py index 8a58ce9..12c9cb7 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -756,7 +756,7 @@ def getframeinfo(frame, context=1): lines = index = None else: start = max(start, 1) - start = min(start, len(lines) - context) + start = max(0, min(start, len(lines) - context)) lines = lines[start:start+context] index = lineno - 1 - start else: -- cgit v0.12