[New-bugs-announce] [issue15812] inspect.getframeinfo() cannot show first line
Richard Oudkerk
report at bugs.python.org
Wed Aug 29 16:54:39 CEST 2012
New submission from Richard Oudkerk:
When inspect.getframeinfo() tries to collect lines of context it never shows the first line (unless context is as big as the number of lines in the file).
The relevant code is
start = lineno - 1 - context//2
try:
lines, lnum = findsource(frame)
except IOError:
lines = index = None
else:
--> start = max(start, 1)
start = max(0, min(start, len(lines) - context))
lines = lines[start:start+context]
index = lineno - 1 - start
I think that
start = max(start, 1)
should be replaced by
start = max(start, 0)
For some reason getframeinfo() (and the functions which use it) don't seem to be tested by the testsuite...
----------
messages: 169387
nosy: sbt
priority: normal
severity: normal
status: open
title: inspect.getframeinfo() cannot show first line
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15812>
_______________________________________
More information about the New-bugs-announce
mailing list