Christian Heimes added the comment: Brett Cannon wrote: > Brett Cannon added the comment: > > OK, for some reason, when PyTokenizer_FindEncoding() is called and the > resulting file is big enough, it starts off with a seek position > (according to TextIOWrapper.tell()) of 4096. That happens to be exactly > half the size of the buffer used by io. > > But I am not sure what the magical size is as creating a file of 4095, > 4096, and 4097 bytes does not trigger this bug.
Maybe rewind() doesn't do what is should do? Could you replace the rewind() calls with fseek(fd, 0, 0)? w/o the rewind() calls in PyTokenizer_FindEncoding I'm getting an error in my new test: Traceback (most recent call last): File "Lib/test/test_imp.py", line 66, in <module> test_main() File "Lib/test/test_imp.py", line 62, in test_main ImportTests, File "/home/heimes/dev/python/py3k/Lib/test/test_support.py", line 541, in run_unittest _run_suite(suite) File "/home/heimes/dev/python/py3k/Lib/test/test_support.py", line 524, in _run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "Lib/test/test_imp.py", line 50, in test_issue1267 self.assertEqual(fd.tell(), 0) AssertionError: 4096 != 0 The number is looking familiar, isn't it? :) Is it the default buffer size on Unix? Christian __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1267> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com