[Python-Dev] Re: [Python-checkins] python/dist/src/Objectslistobject.c,2.153,2.154

Walter Dörwald walter@livinglogic.de
Tue, 17 Jun 2003 19:24:04 +0200


Guido van Rossum wrote:

>>It's still not the same as for str:
>> >>> "123".index("3", 0L, sys.maxint+1)
>>2
>>[61232 refs]
>>*>>> list("123").index("3", 0L, sys.maxint+1)
>>Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>>OverflowError: long int too large to convert to int
> 
> Do you really care about such end cases?

At least str does.

Simply changing
    "ii", &i, &j
to
    "O&O&", _PyEval_SliceIndex, &i, _PyEval_SliceIndex, &j
in the PyArg_ParseTuple() call should fix it.

Bye,
    Walter Dörwald