[issue30763] There is functionality bug in linecache library.

2017-06-27 Thread Guido van Rossum

Changes by Guido van Rossum :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30763] There is functionality bug in linecache library.

2017-06-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I concur with Emily and Guido. This is not a bug. Maybe this should be 
documented more explicitly if "cache" in the name is not enough, I don't know. 
I have no any special relation to the linecache module, maybe just once fixed a 
bug or two.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30763] There is functionality bug in linecache library.

2017-06-26 Thread Guido van Rossum

Guido van Rossum added the comment:

You nailed it, Emily! This is not a bug (though the docs could be a bit more 
upfront about this -- just having "cache" in the name doesn't cut it these days 
:-).

If either Serhiy or Raymond agrees they can close the issue (we won't wait for 
the third vote). If we don't hear from them within a reasonable time we can 
also close the issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30763] There is functionality bug in linecache library.

2017-06-26 Thread Emily Morehouse

Emily Morehouse added the comment:

This is the expected functionality of linecache. As each file is read, it is 
stored in a cache, subsequent calls using linecache do not check to see if the 
file has changed.

If you know that the file has changed, you should call linecache.checkcache() 
to check all files or linecache.checkcache(filename) to check a specific file. 
(https://docs.python.org/2/library/linecache.html#linecache.checkcache)


[Since no one is listed in the Experts Index, I've included some other 
contributors to linecache who can assist in closing out this issue]

--
components: +Library (Lib) -2to3 (2.x to 3.x conversion tool)
nosy: +emilyemorehouse, gvanrossum, rhettinger, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30763] There is functionality bug in linecache library.

2017-06-26 Thread Yang Xiao

Yang Xiao added the comment:

Sorry, there is a mistake in msg296874.

The expectant output shoule be:
['good morning\n']
['good evening\n']
['good morning 123\n']
['good evening 123\n']

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30763] There is functionality bug in linecache library.

2017-06-26 Thread Yang Xiao

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com