classification
Title: access to infinitely recursive list
Type: crash Stage:
Components: Interpreter Core Versions: Python 3.1, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: stack overflow evaluating eval("()" * 30000)
View: 5765
Assigned To: Nosy List: LukMak, amaury.forgeotdarc, jackdied, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2010-02-22 15:02 by LukMak, last changed 2017-06-25 17:59 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
crasher.py jackdied, 2010-02-22 15:56
Messages (5)
msg99742 - (view) Author: LukMak (LukMak) Date: 2010-02-22 15:02
Execution:
>>> l=[]
>>> l.append(l)
>>> l
[[...]]
>>> l[0]
[[...]]
>>> l[0][0][0]
[[...]]
>>> eval('l'+'[0]'*10)
[[...]]
>>> eval('l'+'[0]'*666)
[[...]]
>>> eval('l'+'[0]'*999999)
Segmentation fault

Environment:
2.6.24-27-generic #1 SMP, Ubuntu 8.04.4 LTS, Both Python 2.5.2 from distro repo and Python 3.1.1 compiled by me. But crash seems to be platform and version independent.

Comment:
Should throw RuntimeError: maximum recursion depth exceeded instead of SIGSEGV?
msg99758 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2010-02-22 15:55
confirmed on 3.2 trunk.  This happens on access and not during the repr.  See the attached crasher.py (3 megs of "[0]")
msg99784 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-02-22 16:56
This is a close duplicate of issue5765.
msg112928 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-04 23:57
> This is a close duplicate of issue5765.

Except that #5765 is apparently not a 3.x issue,
while this example, WinXP, 3.1.2 crashes the command window in about 5 sec, while IDLE gets locked (^C does not break).
msg296832 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-25 17:59
Correction to the last message. Issue5765 was a 3.x issue. It was fixed for 3.3+, and it was decided to not fix it for 2.7 and 3.2. This issue is not reproduced in 3.3+.
History
Date User Action Args
2017-06-25 17:59:18serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg296832
2010-08-04 23:57:48terry.reedysetnosy: + terry.reedy

messages: + msg112928
versions: + Python 2.7, - Python 2.5
2010-02-22 16:56:38amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg99784

superseder: stack overflow evaluating eval("()" * 30000)
resolution: duplicate
2010-02-22 15:56:38jackdiedsetfiles: + crasher.py
nosy: + jackdied
messages: + msg99758

2010-02-22 15:02:50LukMakcreate