This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Yang Xiao
Recipients Yang Xiao
Date 2017-06-26.11:30:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1498476608.04.0.760408193877.issue30763@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-06-26 11:30:08Yang Xiaosetrecipients: + Yang Xiao
2017-06-26 11:30:08Yang Xiaosetmessageid: <1498476608.04.0.760408193877.issue30763@psf.upfronthosting.co.za>
2017-06-26 11:30:08Yang Xiaolinkissue30763 messages
2017-06-26 11:30:07Yang Xiaocreate