[Python-bugs-list] [ python-Bugs-456005 ] PyArg_ParseTuple failure in Python 2.2s2

noreply@sourceforge.net noreply@sourceforge.net
Tue, 28 Aug 2001 11:36:29 -0700


Bugs item #456005, was opened at 2001-08-27 20:59
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456005&group_id=5470

Category: Python Interpreter Core
>Group: Not a Bug
>Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: Billy G. Allie (ballie01)
>Assigned to: Tim Peters (tim_one)
Summary: PyArg_ParseTuple failure in Python 2.2s2

Initial Comment:
The following code fails with size being set to
135270484 instead of being left at zero when no
arguements are passed.  This worked in Python 2.1.1.

    ...
    int         fd, cur, end, size, remaining = 0;

    if (!PgLargeObject_check((PyObject *)self, 
PGRES_LO_OPENED|PGRES_LO_READ))
        return (PyObject *)NULL;

    if (!PyArg_ParseTuple(args,"|i:read", &size))
        return (PyObject *)NULL;
    ...

At this point, when the method is called with no
arguments, size is nolonger zero!

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

>Comment By: Tim Peters (tim_one)
Date: 2001-08-28 11:36

Message:
Logged In: YES 
user_id=31435

Closed as agreed.  An uninitialized-vrbl problem is quite 
likely to act the same way each time you run it, provided 
nothing changes (same box, same compiler, same compile 
options, same C library, same code).

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

Comment By: Billy G. Allie (ballie01)
Date: 2001-08-28 09:51

Message:
Logged In: YES 
user_id=8500

1.  remaining was just added (inserted in front of the =). 
taking over the assignment.
2.  The code working with Python2.1 (luck, something with 
2.1, whatever.  It worked every time I tried it.)
3.  The brain ignoring what is there for whiat it thought 
was there.

Close this bug report.  It wasn't with Python 2.2.

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

Comment By: Tim Peters (tim_one)
Date: 2001-08-27 22:10

Message:
Logged In: YES 
user_id=31435

Why do you believe "size" should be 0?  The code snippet 
you showed set "remaining" to 0, but 
left "fd", "cur", "end" and "size" as uninitialized stack 
trash (which could be anything at all, depending on 
whatever junk is sitting in memory at the time).

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

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