summaryrefslogtreecommitdiffstats
path: root/Lib/linecache.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-05-21 21:31:24 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-05-21 21:31:24 (GMT)
commit266e45486659472d3b7c63d397a8083968a0f33f (patch)
treec59eb9e4532f8ddfee9a6b8d69471be73ac298a9 /Lib/linecache.py
parentdd59f1bf92958c698cc4223e9762e5d46a498c38 (diff)
downloadcpython-266e45486659472d3b7c63d397a8083968a0f33f.zip
cpython-266e45486659472d3b7c63d397a8083968a0f33f.tar.gz
cpython-266e45486659472d3b7c63d397a8083968a0f33f.tar.bz2
ensure the last line has a trailing newline #8782
Diffstat (limited to 'Lib/linecache.py')
-rw-r--r--Lib/linecache.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/linecache.py b/Lib/linecache.py
index e7c33e1..c999851 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -133,6 +133,8 @@ def updatecache(filename, module_globals=None):
except IOError, msg:
## print '*** Cannot open', fullname, ':', msg
return []
+ if lines and not lines[-1].endswith('\n'):
+ lines[-1] += '\n'
size, mtime = stat.st_size, stat.st_mtime
cache[filename] = size, mtime, lines, fullname
return lines