[New-bugs-announce] [issue22335] Python 3: Segfault instead of MemoryError when bytearray too big

swanson report at bugs.python.org
Thu Sep 4 12:38:57 CEST 2014


New submission from swanson:

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 "<stdin>", line 1, in <module>
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 "<stdin>", line 1, in <module>
MemoryError
>>>

----------
messages: 226356
nosy: swanson
priority: normal
severity: normal
status: open
title: Python 3: Segfault instead of MemoryError when bytearray too big
type: crash
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22335>
_______________________________________


More information about the New-bugs-announce mailing list