[New-bugs-announce] [issue16527] (very) long list of elif causes segfault
Alexis Daboville
report at bugs.python.org
Thu Nov 22 00:41:01 CET 2012
New submission from Alexis Daboville:
Hi,
It looks like using a very long list of elif makes CPython segfault. You can try it with the attached file, which looks like this:
if False:
pass
elif False:
pass
# thousands of elifs
elif False:
pass
$ python elif_segfault.py
Segmentation fault.
CPython versions tested:
3.x (all segfaults):
3.1 on Debian
3.2 on Arch Linux
3.3 on Windows
2.6 on Debian: segfaults with a longer list of elifs than the one in the attached file.
The PyPy behaviour seems better: it raises 'RuntimeError: maximum recursion depth exceeded'.
A possible cause (if I understood <http://greentreesnakes.readthedocs.org/en/latest/nodes.html#If> well) is that there are no elif nodes in the AST, elif are just plain ifs which are stored recursively in the else part of the previous if.
(I'm not sure if that's an issue as it's not a real use case, but it makes CPython segfault and I was advised on #python-fr to report it anyway.)
----------
files: elif_segfault.py
messages: 176081
nosy: alexis.d
priority: normal
severity: normal
status: open
title: (very) long list of elif causes segfault
versions: Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file28068/elif_segfault.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16527>
_______________________________________
More information about the New-bugs-announce
mailing list