[ python-Bugs-1502750 ] PyArg_ParseTuple(args, "i") and sys.maxint

SourceForge.net noreply at sourceforge.net
Thu Jun 8 15:32:46 CEST 2006


Bugs item #1502750, was opened at 2006-06-08 08:42
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1502750&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: M.-A. Lemburg (lemburg)
Assigned to: Georg Brandl (gbrandl)
Summary: PyArg_ParseTuple(args, "i") and sys.maxint

Initial Comment:
The argument parser seems to have trouble with
sys.maxint on 64-bit platforms:

>>> import sys
>>> sys.maxint
9223372036854775807
>>> sys.setcheckinterval(sys.maxint)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: signed integer is greater than maximum

>>> sys.setcheckinterval(2**31-1)
>>> sys.setcheckinterval(2**31)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: signed integer is greater than maximum

Looks like INT_MAX isn't the right value to test against.

This is on AMD64, Linux2.6, gcc 3.3.


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

>Comment By: Georg Brandl (gbrandl)
Date: 2006-06-08 13:32

Message:
Logged In: YES 
user_id=849994

The bug isn't in getargs. Format code "i" wants a C integer.

Question is whether sys.setcheckinterval and perhaps dozens
of other functions should be changed to accept "l".

Changing to Invalid. Reverted checkin.

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

Comment By: Georg Brandl (gbrandl)
Date: 2006-06-08 12:47

Message:
Logged In: YES 
user_id=849994

No, INT_MAX is definitely not the right value. Changed to
LONG_MAX and LONG_MIN in rev. 46741, 46742 (2.4).

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

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


More information about the Python-bugs-list mailing list