[New-bugs-announce] [issue5765] stack overflow evaluating eval("()" * 30000)

Gabriel Genellina report at bugs.python.org
Thu Apr 16 01:37:37 CEST 2009

New submission from Gabriel Genellina <gagsl-py2 at yahoo.com.ar>:

Originally reported by Juanjo Conti at PyAr: 

Evaluating this expression causes a stack overflow, and the Python 
interpreter exits abnormally:

eval("()" * 30000)

3.0.1, 2.6, 2.5 and current 2.x trunk all fail on Windows; the original 
reporter was likely using Linux. Some versions may require a larger 
constant instead of 30000.

2.4 isn't affected; it raises a "TypeError: 'tuple' object is not 
callable" as expected, even for extremely long sequences.

Alberto Bertogli said: inside eval, symtable_visit_expr() (Python/
symtable.c) is called recursively (thru the VISIT/VISIT_SEQ macros), 
eventually taking all stack space.

components: Interpreter Core
messages: 86006
nosy: gagenellina
severity: normal
status: open
title: stack overflow evaluating eval("()" * 30000)
type: crash
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list