Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea5d17d

Browse files
committed
In open(), only set the buffer size from st.st_blksize when it is greater
than 1. This matches the pure Python implementation in _pyio and should fix a couple of failures on the NetBSD buildbot.
1 parent d72402e commit ea5d17d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Modules/_io/_iomodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ io_open(PyObject *self, PyObject *args, PyObject *kwds)
451451
if (fileno == -1 && PyErr_Occurred())
452452
goto error;
453453

454-
if (fstat(fileno, &st) >= 0)
454+
if (fstat(fileno, &st) >= 0 && st.st_blksize > 1)
455455
buffering = st.st_blksize;
456456
}
457457
#endif

0 commit comments

Comments
 (0)