[New-bugs-announce] [issue30763] There is functionality bug in linecache library.
Yang Xiao
report at bugs.python.org
Mon Jun 26 07:30:08 EDT 2017
New submission from Yang Xiao:
There is a functionality bug in linecache library.
>>test.py<<
import linecache
def test_getline(f):
print linecache.getlines(f)
if __name__ == "__main__":
tf1 = 'aaa'
with open(tf1,'w') as f:
f.write('good morning\n')
test_getline(tf1)
tf2 = 'bbb'
with open(tf2,'w') as f:
f.write('good evening\n')
test_getline(tf2)
tf1 = 'aaa'
with open(tf1,'w') as f:
f.write('good morning 123\n')
test_getline(tf1)
tf2 = 'bbb'
with open(tf2,'w') as f:
f.write('good evening 123\n')
test_getline(tf2)
The expectant output shoule be:
['good morning\n']
['good evening\n']
['good morning\n']
['good evening\n']
However, the script above outputs below:
['good morning\n']
['good evening\n']
['good morning\n']
['good evening\n']
I think there is a bug about implementation of linecache library.
----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 296874
nosy: Yang Xiao
priority: normal
severity: normal
status: open
title: There is functionality bug in linecache library.
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30763>
_______________________________________
More information about the New-bugs-announce
mailing list