[Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.134,2.135

Guido van Rossum gvanrossum@users.sourceforge.net
Tue, 23 Oct 2001 14:25:26 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv25768/Objects

Modified Files:
	fileobject.c 
Log Message:
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]



Index: fileobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v
retrieving revision 2.134
retrieving revision 2.135
diff -C2 -d -r2.134 -r2.135
*** fileobject.c	2001/10/12 20:01:53	2.134
--- fileobject.c	2001/10/23 21:25:24	2.135
***************
*** 607,611 ****
  {
  	char *ptr;
! 	size_t ntodo, ndone, nnow;
  
  	if (f->f_fp == NULL)
--- 607,612 ----
  {
  	char *ptr;
! 	int ntodo;
! 	size_t ndone, nnow;
  
  	if (f->f_fp == NULL)