Commit 00ebd46d authored by Guido van Rossum's avatar Guido van Rossum

SF patch #474175 (Jay T Miller): file.readinto arg parsing bug

    The C-code in fileobject.readinto(buffer) which parses
    the arguments assumes that size_t is interchangeable
    with int:

	    size_t ntodo, ndone, nnow;

	    if (f->f_fp == NULL)
		    return err_closed();
	    if (!PyArg_Parse(args, "w#", &ptr, &ntodo))
		    return NULL;

    This causes a problem on Alpha / Tru64 / OSF1 v5.1
    where size_t is a long and sizeof(long) != sizeof(int).

    The patch I'm proposing declares ntodo as an int.  An
    alternative might be to redefine w# to expect size_t.

[We can't change w# because there are probably third party modules
relying on it. GvR]
parent 0d429e8c
...@@ -279,6 +279,7 @@ Dieter Maurer ...@@ -279,6 +279,7 @@ Dieter Maurer
Greg McFarlane Greg McFarlane
Michael McLay Michael McLay
Gordon McMillan Gordon McMillan
Jay T. Miller
Caolan McNamara Caolan McNamara
Craig McPheeters Craig McPheeters
Lambert Meertens Lambert Meertens
......
...@@ -606,7 +606,8 @@ static PyObject * ...@@ -606,7 +606,8 @@ static PyObject *
file_readinto(PyFileObject *f, PyObject *args) file_readinto(PyFileObject *f, PyObject *args)
{ {
char *ptr; char *ptr;
size_t ntodo, ndone, nnow; int ntodo;
size_t ndone, nnow;
if (f->f_fp == NULL) if (f->f_fp == NULL)
return err_closed(); return err_closed();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment