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 christian.heimes
Recipients brett.cannon, christian.heimes, gvanrossum
Date 2007-10-20.02:33:55
SpamBayes Score 0.0032101145
Marked as misclassified No
Message-id <47196912.9060203@cheimes.de>
In-reply-to <1192846624.43.0.787308902814.issue1267@psf.upfronthosting.co.za>
Content
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
History
Date User Action Args
2007-10-20 02:33:56christian.heimessetspambayes_score: 0.00321011 -> 0.0032101145
recipients: + christian.heimes, gvanrossum, brett.cannon
2007-10-20 02:33:56christian.heimeslinkissue1267 messages
2007-10-20 02:33:55christian.heimescreate