[issue21932] os.read() must use Py_ssize_t for the size parameter

STINNER Victor report at bugs.python.org
Mon Jul 7 15:37:54 CEST 2014


New submission from STINNER Victor:

os.read() currently uses the int type for the size parameter, whereas the C function uses a C size_t parameter:

       ssize_t read(int fd, void *buf, size_t count);

The Python function must use the Py_ssize_t type, but truncate to INT_MAX on Windows, as done in FileIO.read(). It would help to implement FileIO in pure Python: issue #21859.

I don't think that this enhancement should be backported to Python 2.7 nor Python 3.4.

----------
files: posix_read_py_ssize_t.patch
keywords: patch
messages: 222462
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: os.read() must use Py_ssize_t for the size parameter
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file35882/posix_read_py_ssize_t.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21932>
_______________________________________


More information about the Python-bugs-list mailing list