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 Otacon.Karurosu
Recipients Otacon.Karurosu
Date 2011-08-25.23:09:02
SpamBayes Score 2.0328552e-07
Marked as misclassified No
Message-id <1314313743.28.0.803214021161.issue12843@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2011-08-25 23:09:03Otacon.Karurosusetrecipients: + Otacon.Karurosu
2011-08-25 23:09:03Otacon.Karurosusetmessageid: <1314313743.28.0.803214021161.issue12843@psf.upfronthosting.co.za>
2011-08-25 23:09:02Otacon.Karurosulinkissue12843 messages
2011-08-25 23:09:02Otacon.Karurosucreate