Issue 22335: Python 3: Segfault instead of MemoryError when bytearray too big (original) (raw)
On Python 3, but not Python 2, you crash with a Segmentation Fault instead of getting a MemoryError as expected. It seems to only be a problem with bytearray, not with other things like tuple:
$ python3 Python 3.4.0 (default, Apr 11 2014, 13:05:18) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information.
bytearray(0x7FFFFFFF) Segmentation fault (core dumped) $
compare to:
$ python Python 2.7.6 (default, Mar 22 2014, 22:59:38) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
bytearray(0x7FFFFFFF) Traceback (most recent call last): File "", line 1, in MemoryError
$ python3 Python 3.4.0 (default, Apr 11 2014, 13:05:18) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information.
(0,)*0x7FFFFFFF Traceback (most recent call last): File "", line 1, in MemoryError