diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-06-20 19:13:27 +0000 |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-06-20 19:13:27 +0000 |
commit | 3c0d013db40bd704908d7067228d35ed3f6b46c5 (patch) | |
tree | 932a7ddacbcb0b45bba5b24e5ac5a1a137c83901 /Lib/test/test_longexp.py | |
parent | 94988067b96c6187fd940eaff99c2c5a68daac68 (diff) | |
download | cpython-git-3c0d013db40bd704908d7067228d35ed3f6b46c5.tar.gz |
verify that Python raises SyntaxError for long and deeply-nested expressions
Diffstat (limited to 'Lib/test/test_longexp.py')
-rw-r--r-- | Lib/test/test_longexp.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_longexp.py b/Lib/test/test_longexp.py new file mode 100644 index 0000000000..38eb79b1c8 --- /dev/null +++ b/Lib/test/test_longexp.py @@ -0,0 +1,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" + |