[issue24666] Buffered I/O does not take file position into account when reading blocks

2021-10-22 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24666] Buffered I/O does not take file position into account when reading blocks

2021-10-22 Thread STINNER Victor


STINNER Victor  added the comment:

Hi, the io module doesn't use the block size of the filesystem. 
io.BufferedReader uses a default buffer size of 8 * 1024 bytes. I don't think 
that it's really important to respect the block size in Python. There are 
buffers at many levels. io.BufferedReader is a buffer in user space, but there 
is also a buffer in the kernel. I'm not sure how relevant is to use know that a 
"disk sector" is 4096 bytes, when most people use SSDs which use way larger SSD 
blocks (ex: 512 KB). It's hard to say what's real block size. The disk firmware 
can lie (pretend it's 4 KiB) or the kernel can lie. The disk firmware can 
emulate different "block sizes".

If you write a database, maybe you would like to start caring about that, but 
you may want to use direct I/O (O_DIRECT) flag for that.

In short, Python works as expect, it's efficient and you should not worry about 
that ;-)

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24666] Buffered I/O does not take file position into account when reading blocks

2020-01-28 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
assignee: docs@python -> 
components:  -2to3 (2.x to 3.x conversion tool), Build, Cross-Build, 
Documentation, Extension Modules, FreeBSD, Installation, Interpreter Core, 
Library (Lib), SSL, Tests, Unicode, ctypes
nosy:  -docs@python, koobs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24666] Buffered I/O does not take file position into account when reading blocks

2020-01-28 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy:  -Alex.Willmer, ezio.melotti, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24666] Buffered I/O does not take file position into account when reading blocks

2020-01-27 Thread CRYSTAL


Change by CRYSTAL :


--
assignee:  -> docs@python
components: +2to3 (2.x to 3.x conversion tool), Build, Cross-Build, 
Documentation, Extension Modules, FreeBSD, Installation, Interpreter Core, 
Library (Lib), SSL, Tests, Unicode, ctypes
nosy: +Alex.Willmer, docs@python, ezio.melotti, koobs, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24666] Buffered I/O does not take file position into account when reading blocks

2015-07-18 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +benjamin.peterson, pitrou, stutzbach

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24666
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24666] Buffered I/O does not take file position into account when reading blocks

2015-07-18 Thread Eric Pruitt

New submission from Eric Pruitt:

When buffering data from a file, the buffered I/O does not take into account 
the current file descriptor position. In the following example, I open a file 
and seek forward 1,000 bytes:

 f = open(test-file, rb)
 f.seek(1000)
1000
 f.readline()

The filesystem on which test-file resides has a block size of 4,096 bytes, so 
on the backend, I would expect Python to read 3,096 bytes so the next read will 
be aligned with the filesystem blocks. What actually happens is that Python 
reads a 4,096 bytes. This is the output from an strace attached to the 
interpreter above:

Process 16543 attached
lseek(4, 0, SEEK_CUR)   = 0
lseek(4, 1000, SEEK_SET)= 1000
read(4, \000\000\000\000\000\000\000\000\000\000..., 4096) = 4096

--
components: IO
messages: 246931
nosy: ericpruitt
priority: normal
severity: normal
status: open
title: Buffered I/O does not take file position into account when reading blocks
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24666
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com