[Patches] [ python-Patches-474175 ] file.readinto arg parsing bug

noreply@sourceforge.net noreply@sourceforge.net
Tue, 23 Oct 2001 14:26:46 -0700


Patches item #474175, was opened at 2001-10-23 11:04
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=474175&group_id=5470

Category: Core (C code)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Jay T Miller (jaytmiller)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: file.readinto arg parsing bug

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-23 14:26

Message:
Logged In: YES 
user_id=6380

Thanks! Fixed in CVS, will be in 2.2b2.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=474175&group_id=5470