summaryrefslogtreecommitdiff
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-01-02 06:57:43 +0300
committerBerker Peksag <berker.peksag@gmail.com>2017-01-02 06:57:43 +0300
commitee7bb6623a90879383bde2cd5da5c635ced50e1c (patch)
treeb9b7f46521b2d5e1073f0a4f34108ff8e44b4acf /Lib/inspect.py
parent530a679cc28c846cb53035cd8a921812c3153d28 (diff)
downloadcpython-ee7bb6623a90879383bde2cd5da5c635ced50e1c.tar.gz
Issue #15812: inspect.getframeinfo() now correctly shows the first line of a context
Patch by Sam Breese.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index e6dae1e048..6b9e0b00b5 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1416,7 +1416,7 @@ def getframeinfo(frame, context=1):
except OSError:
lines = index = None
else:
- start = max(start, 1)
+ start = max(start, 0)
start = max(0, min(start, len(lines) - context))
lines = lines[start:start+context]
index = lineno - 1 - start