Author hakril
Recipients hakril, mark.dickinson, r.david.murray, rhettinger, serhiy.storchaka, vstinner
Date 2014-12-09.10:46:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1418121999.47.0.576207634511.issue22939@psf.upfronthosting.co.za>
In-reply-to
Content
> Also, PY_SSIZE_T_MAX is a valid value to pass to PySequence_GetItem(), so it shouldn't be blocked unless necessary.

I agree with you, that's why my first path was checking at the next call if it->it_index had overflowed. But then it relies on undefined behaviour.

> I would think that the PY_SSIZE_T_MAX check belongs inside the:
> 
>     if (result != NULL) {
>         it->it_index++;
>         return result;
>     }

If we raise the OverflowError when it->it_index really overflow (just after the getitem PY_SSIZE_T_MAX).
Is it really necessary to do the overflow check after the GetItem ? because the value returned by `PySequence_GetItem(seq, PY_SSIZE_T_MAX);` will be never used.
History
Date User Action Args
2014-12-09 10:46:39hakrilsetrecipients: + hakril, rhettinger, mark.dickinson, vstinner, r.david.murray, serhiy.storchaka
2014-12-09 10:46:39hakrilsetmessageid: <1418121999.47.0.576207634511.issue22939@psf.upfronthosting.co.za>
2014-12-09 10:46:39hakrillinkissue22939 messages
2014-12-09 10:46:39hakrilcreate