Message296874
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. |
|
Date |
User |
Action |
Args |
2017-06-26 11:30:08 | Yang Xiao | set | recipients:
+ Yang Xiao |
2017-06-26 11:30:08 | Yang Xiao | set | messageid: <1498476608.04.0.760408193877.issue30763@psf.upfronthosting.co.za> |
2017-06-26 11:30:08 | Yang Xiao | link | issue30763 messages |
2017-06-26 11:30:07 | Yang Xiao | create | |
|