Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit108e65b

Browse files
committed
Add clean code
1 parent9315688 commit108e65b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎Modules/posixmodule.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11342,6 +11342,20 @@ os_read_impl(PyObject *module, int fd, Py_ssize_t length)
1134211342

1134311343
length=Py_MIN(length,_PY_READ_MAX);
1134411344

11345+
staticlongpage_size;
11346+
if (page_size==0)
11347+
page_size=sysconf(_SC_PAGE_SIZE);
11348+
11349+
#ifndefMS_WINDOWS
11350+
if (length>page_size*16) {
11351+
structstatstatbuffer;
11352+
fstat(fd,&statbuffer);
11353+
if (S_ISFIFO(statbuffer.st_mode)) {
11354+
length=Py_MIN(page_size*16,length);
11355+
}
11356+
}
11357+
#endif
11358+
1134511359
buffer=PyBytes_FromStringAndSize((char*)NULL,length);
1134611360
if (buffer==NULL)
1134711361
returnNULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp