Message270622
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 |
|
Date |
User |
Action |
Args |
2016-07-17 09:17:35 | ztane | set | recipients:
+ ztane, martin.panter, serhiy.storchaka, xiang.zhang, Decorater |
2016-07-17 09:17:35 | ztane | set | messageid: <1468747055.45.0.556377255705.issue27507@psf.upfronthosting.co.za> |
2016-07-17 09:17:35 | ztane | link | issue27507 messages |
2016-07-17 09:17:35 | ztane | create | |
|