New submission from Otacon Karurosu :
When opening a file in append mode and attempting to read after doing a write
operation causes the read method to overflow and read memory directly (instead
of returning an empty string)
The following code prints garbage:
f2 = open("test", "w+b")
f2.write("python!")
print f2.readline()
However the following print empty lines:
f2 = open("test", "w+b")
print f2.readline()
f2 = open("test", "w+b")
f2.write("python!")
f2.seek(f2.tell())
print f2.readline()
This also happens with tempfiles:
f = tempfile.TemporaryFile()
f.write("python!")
print f.readline()
--
components: Interpreter Core, Library (Lib)
messages: 142994
nosy: Otacon.Karurosu
priority: normal
severity: normal
status: open
title: file object read* methods in append mode overflows
type: behavior
versions: Python 2.6, Python 2.7
___
Python tracker
<http://bugs.python.org/issue12843>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com