folks, hi, http://bugs.winehq.org/show_bug.cgi?id=16982 related to this:
from array import array TESTFN = "testfile.txt" def fail(x): print x testlines = [ "spam, spam and eggs\n", "eggs, spam, ham and spam\n", "saussages, spam, spam and eggs\n", "spam, ham, spam and eggs\n", "spam, spam, spam, spam, spam, ham, spam\n", "wonderful spaaaaaam.\n" ] try: # Prepare the testfile bag = open(TESTFN, "w") bag.writelines(testlines) bag.close() f = open(TESTFN) testline = testlines.pop(0) line = f.readline() testline = testlines.pop(0) buf = array("c", "\x00" * len(testline)) f.readinto(buf) testline = testlines.pop(0) print "length of testline:", len(testline) line = f.read(len(testline)) if line != testline: fail("read() after next() with empty buffer " "failed. Got %r, expected %r" % (line, testline)) lines = f.readlines() if lines != testlines: fail("readlines() after next() with empty buffer " "failed. Got %r, expected %r" % (line, testline)) f.close() finally: os.unlink(TESTFN) which is a reduced version of Lib/test/test_file.py running under wine, ftell() has an off-by-one bug, where the file position accidentally doesn't include the fact that the CR of the CRLF has been skipped. but, now with the fgets() bug fixed, the regression tests pass, but there's still the off-by-one bug which _isn't_ caught. this really should be added as a windows test. actually, it should be added as a test for everything: it's not always reasonable to assume that OSes get their file positions right :) l. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com