8000 gh-120754: Reduce system calls in full-file readall case by cmaloney · Pull Request #120755 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-120754: Reduce system calls in full-file readall case #120755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Py_SAFE_DOWNCAST -> C casts
  • Loading branch information
cmaloney committed Jul 3, 2024
commit 9be6d1dc4dc2ed02f4a0fef36a1103f904ad8d81
4 changes: 2 additions & 2 deletions Modules/_io/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ _io_FileIO_readall_impl(fileio *self)
bufsize = _PY_READ_MAX;
}
else {
bufsize = Py_SAFE_DOWNCAST(end, Py_off_t, size_t) + 1;
bufsize = (size_t)end + 1;
}

/* While a lot of code does open().read() to get the whole contents
Expand All @@ -759,7 +759,7 @@ _io_FileIO_readall_impl(fileio *self)
Py_END_ALLOW_THREADS

if (end >= pos && pos >= 0 && end - pos < _PY_READ_MAX) {
bufsize = Py_SAFE_DOWNCAST(end - pos, Py_off_t, size_t) + 1;
bufsize = (size_t)(end - pos) + 1;
}
}
}
Expand Down
Loading
0