Author jeff.allen
Recipients amit, fwierzbicki, jeff.allen, psykiatris, santa4nt, zyasoft
Date 2018-04-19.06:56:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This would be better as a distinct test, and maybe in test_file_jy. We always aim *not* to have a special Jython variant of a CPython test (under the same file name). We do here already, but it would be nice not to make it diverge further.

I think that earlier you demonstrated the bug only when the start position of the readline was not the start of the file. Using essentially your code and CPython 2.7.14 I get:

testSeekTell (__main__.AutoFileTests2) ... FAIL

FAIL: testSeekTell (__main__.AutoFileTests2)
Traceback (most recent call last):
  File "dist\Lib\test\", line 63, in testSeekTell
    self.assertEqual(self.f.tell(), 31)
AssertionError: 10L != 31

The first line of the file is terminated by the \x0a byte, that was inserted by self.f.write(bytes(range(20))). If we keep the file, instead of tidying up, we can see (CPython):

>>> f = open('$test_1_tmp', 'r')
>>> f.readline()
>>> f.readline()
'\x0b\x0c\r\x0eJython is great\n'
>>> f.close()

I was surprised the \r is not also a line end, but that's a thing you have to ask for explicitly:
>>> f = open('$test_1_tmp', 'rU') # U = universal newlines mode
>>> f.readline()
>>> f.readline()
>>> f.readline()
'\x0eJython is great\n'
>>> f.close()

We perhaps have a bone to pick with CPython. Since this byte is at index 10 in the file, and the return from readline includes that byte, I think Jython is correct to return 11 and CPython is off by one!
Date User Action Args
2018-04-19 06:56:54jeff.allensetmessageid: <>
2018-04-19 06:56:54jeff.allensetrecipients: + jeff.allen, fwierzbicki, zyasoft, santa4nt, amit, psykiatris
2018-04-19 06:56:54jeff.allenlinkissue2363 messages
2018-04-19 06:56:54jeff.allencreate