Message11890

Author psykiatris
Recipients amit, fwierzbicki, psykiatris, santa4nt, tuck182, zyasoft
Date 2018-04-11.05:24:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <9a6e2465-6401-f196-a3c7-346a23f148cb@gmail.com>
In-reply-to <1523022669.27.0.682650639539.issue2363@psf.upfronthosting.co.za>
Content
I have added a patch for the test_fileseek.py to add a test reversing 
the readline/red.

What I relized is while the read buffer may be larger, the readline 
reads to the newline. Since the newline is at the 101st position in the 
test.log, it apparently skewing the results. if you reverse it, run 
readline() first, then read(), then the results are correct. Here is my 
output for both:

2nd patch fixes results. I had a couple of prints backwards. But the 
final result is below:

========

--Result of read--
File position:        1024 <-- read limit
Amount to seek back:  -200
New position:          824
Correct position!
--- Result of readline() ---
File position:         101 <-- includes NEWLINE
Amount to seek back:  -100
New position in file:  200
Wrong position
--- Result of both() ---
File position from read():      4202
File position from readline():   101
Amount to seek back:            -100
New position in file:           4201
Wrong position
--- Result of both_reversed() ---
File position from readline():   101
File position from read():      1125
Amount to seek back:            -100
New position in file:           1025
Correct position

On 04/06/2018 06:51 AM, Patrick Palczewski wrote:
> Patrick Palczewski <psykiatris@gmail.com> added the comment:
>
Files
File name Uploaded
test_fileseek1.patch psykiatris, 2018-04-11.05:23:59
test_fileseek2.patch psykiatris, 2018-04-11.05:24:00
unnamed psykiatris, 2018-04-11.05:23:59
History
Date User Action Args
2018-04-11 05:24:00psykiatrissetrecipients: + psykiatris, fwierzbicki, zyasoft, tuck182, santa4nt, amit
2018-04-11 05:24:00psykiatrislinkissue2363 messages
2018-04-11 05:24:00psykiatriscreate