summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-06-17 12:37:17 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-06-17 12:37:17 (GMT)
commita58eed9cca47c6548a231600e3e3379a273b0908 (patch)
tree4bd90d072608056ff57f312b0f17deab3f6189b9 /Lib/test
parent19d8cc524bb4f6c41b2602c025ce90fe85e1e991 (diff)
downloadcpython-a58eed9cca47c6548a231600e3e3379a273b0908.zip
cpython-a58eed9cca47c6548a231600e3e3379a273b0908.tar.gz
cpython-a58eed9cca47c6548a231600e3e3379a273b0908.tar.bz2
Merged revisions 82043 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82043 | mark.dickinson | 2010-06-17 13:33:22 +0100 (Thu, 17 Jun 2010) | 6 lines Issue #9011: Remove buggy and unnecessary ST->AST compilation code dealing with unary minus applied to a constant. The removed code was mutating the ST, causing a second compilation to fail. (The peephole optimizer already takes care of optimizing this case, so there's no lost optimization opportunity here.) ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_parser.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
index c7cc13f..e52be06 100644
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -479,8 +479,18 @@ class CompileTestCase(unittest.TestCase):
st = parser.suite('a = "\\u1"')
self.assertRaises(SyntaxError, parser.compilest, st)
+ def test_issue_9011(self):
+ # Issue 9011: compilation of an unary minus expression changed
+ # the meaning of the ST, so that a second compilation produced
+ # incorrect results.
+ st = parser.expr('-3')
+ code1 = parser.compilest(st)
+ self.assertEqual(eval(code1), -3)
+ code2 = parser.compilest(st)
+ self.assertEqual(eval(code2), -3)
+
class ParserStackLimitTestCase(unittest.TestCase):
- """try to push the parser to/over it's limits.
+ """try to push the parser to/over its limits.
see http://bugs.python.org/issue1881 for a discussion
"""
def _nested_expression(self, level):