Author ztane
Recipients Decorater, martin.panter, serhiy.storchaka, xiang.zhang, ztane
Date 2016-07-17.09:17:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468747055.45.0.556377255705.issue27507@psf.upfronthosting.co.za>
In-reply-to
Content
Ah indeed, this is a bytearray and it is indeed possible to theoretically allocate PY_SSIZE_T_MAX bytes, if on an architecture that does segmented memory.

As for 

    if (addition > PY_SSIZE_T_MAX - len - 1) {

it is very clear to *us* but it is not quite self-documenting on why to do it this way to someone who doesn't know undefined behaviours in C (hint: next to no one knows, judging from the amount of complaints that the GCC "bug" received), instead of say

    if (INT_ADD_OVERFLOW(len, addition))

Where the INT_ADD_OVERFLOW would have a comment above explaining why it has to be done that way. But more discussion about it at https://bugs.python.org/issue1621
History
Date User Action Args
2016-07-17 09:17:35ztanesetrecipients: + ztane, martin.panter, serhiy.storchaka, xiang.zhang, Decorater
2016-07-17 09:17:35ztanesetmessageid: <1468747055.45.0.556377255705.issue27507@psf.upfronthosting.co.za>
2016-07-17 09:17:35ztanelinkissue27507 messages
2016-07-17 09:17:35ztanecreate