Antti Haapala added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27507>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to