summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_longexp.py
blob: 38eb79b1c8c5bca88f99ccf2da219360152f1a72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
REPS = 8192

try:
    eval("2+2+" * REPS + "+3.14159265")
except SyntaxError, msg:
    print "Caught SyntaxError for long expression:", msg
else:
    print "Long expression did not raise SyntaxError"

## This test prints "s_push: parser stack overflow" on stderr,
    ## which seems to confuse the test harness
##try:
##    eval("(2+" * REPS + "0" + ")" * REPS)
##except SyntaxError:
##    pass
##else:
##    print "Deeply nested expression did not raised SyntaxError"