[ python-Bugs-1156259 ] [2.4 regression] seeking in codecs.reader
broken
SourceForge.net
noreply at sourceforge.net
Thu Mar 3 23:29:54 CET 2005
Bugs item #1156259, was opened at 2005-03-03 23:29
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1156259&group_id=5470
Category: Extension Modules
Group: Python 2.4
Status: Open
Resolution: None
Priority: 7
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: [2.4 regression] seeking in codecs.reader broken
Initial Comment:
[forwarded from
https://bugzilla.ubuntu.com/show_bug.cgi?id=6972 ]
This is a regression; the following script (call as
"scriptname some_textfile")
fails.
It is obvious that the file starts with a number of
random bytes from the
previous run.
Uncommenting the two #XXX lines makes the bug go away.
So does running it with
Python 2.3.5
import sys
import codecs
from random import random
data = codecs.getreader("utf-8")(open(sys.argv[1]))
df = data.read()
for t in range(30):
#XXX data.seek(0,1)
#XXX data.read()
data.seek(0,0)
dn=""
for l in data:
dn += l
if random() < 0.1: break
if not df.startswith(dn):
print "OUCH",t
print "BAD:", dn[0:100]
print "GOOD:", df[0:100]
sys.exit(1)
print "OK",len(df)
sys.exit(0)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1156259&group_id=5470
More information about the Python-bugs-list
mailing list