diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2012-11-25 17:11:33 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2012-11-25 17:11:33 (GMT) |
commit | b1cc6aa2df228572c5819091a18ac2c0ab6abe5a (patch) | |
tree | be9832833c04a1fb53fedd73500111afa05da8c1 /Lib | |
parent | 1658797a9d27e5307be1c0c9ab653ebf1d8c80d7 (diff) | |
download | cpython-b1cc6aa2df228572c5819091a18ac2c0ab6abe5a.zip cpython-b1cc6aa2df228572c5819091a18ac2c0ab6abe5a.tar.gz cpython-b1cc6aa2df228572c5819091a18ac2c0ab6abe5a.tar.bz2 |
Issue #9011: AST creation no longer modifies CST for negated numeric literals.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_parser.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 93fbaec..12fa89c 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -567,6 +567,17 @@ class CompileTestCase(unittest.TestCase): st = parser.suite('a = u"\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. see http://bugs.python.org/issue1881 for a discussion |