Skip to content

Commit ad7736f

Browse files
corona10serhiy-storchaka
authored andcommitted
bpo-38265: Update os.pread to accept the length type as Py_ssize_t. (GH-16359)
1 parent 12f209e commit ad7736f

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Update the *length* parameter of :func:`os.pread` to accept
2+
:c:type:`Py_ssize_t` instead of :c:type:`int`.

Modules/clinic/posixmodule.c.h

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8827,11 +8827,10 @@ os_readv_impl(PyObject *module, int fd, PyObject *buffers)
88278827

88288828
#ifdef HAVE_PREAD
88298829
/*[clinic input]
8830-
# TODO length should be size_t! but Python doesn't support parsing size_t yet.
88318830
os.pread
88328831
88338832
fd: int
8834-
length: int
8833+
length: Py_ssize_t
88358834
offset: Py_off_t
88368835
/
88378836
@@ -8842,8 +8841,8 @@ the beginning of the file. The file offset remains unchanged.
88428841
[clinic start generated code]*/
88438842

88448843
static PyObject *
8845-
os_pread_impl(PyObject *module, int fd, int length, Py_off_t offset)
8846-
/*[clinic end generated code: output=435b29ee32b54a78 input=084948dcbaa35d4c]*/
8844+
os_pread_impl(PyObject *module, int fd, Py_ssize_t length, Py_off_t offset)
8845+
/*[clinic end generated code: output=3f875c1eef82e32f input=85cb4a5589627144]*/
88478846
{
88488847
Py_ssize_t n;
88498848
int async_err = 0;

0 commit comments

Comments
 (0)