[issue21199] Python on 64-bit Windows uses signed 32-bit type for read length

STINNER Victor report at bugs.python.org
Wed Apr 16 08:19:18 CEST 2014


STINNER Victor added the comment:

> On Windows, the type of the size parameter of read() is an unsigned int, not long nor size_t (...)

Oh, I read the wrong function. In fact, file_read() of Python 2.7 calls fread() and fread() uses size_t types, even on Windows.

To make sure that we are talking about the same thing, I wrote the attached file_read_size_t.patch file which replaces "l" with "n" in file_read().

Note: os.read() uses int types, even on Python 3.5, whereas read() uses a size_t type for the number of bytes on Linux.

----------
keywords: +patch
Added file: http://bugs.python.org/file34906/file_read_size_t.patch

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


More information about the Python-bugs-list mailing list