mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #9011: AST creation no longer modifies CST for negated numeric literals.
This commit is contained in:
parent
1658797a9d
commit
b1cc6aa2df
3 changed files with 29 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue