mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Patch #1346214: correctly optimize away "if 0"-style stmts
(thanks to Neal for review)
This commit is contained in:
parent
9f16760666
commit
ddbaa660d3
5 changed files with 57 additions and 18 deletions
|
@ -733,7 +733,7 @@ syntax_tests = """
|
|||
... yield 1
|
||||
Traceback (most recent call last):
|
||||
..
|
||||
SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.syntax[0]>, line 2)
|
||||
SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.syntax[0]>, line 3)
|
||||
|
||||
>>> def f():
|
||||
... yield 1
|
||||
|
@ -876,9 +876,9 @@ These are fine:
|
|||
... if 0:
|
||||
... return 3 # but *this* sucks (line 8)
|
||||
... if 0:
|
||||
... yield 2 # because it's a generator
|
||||
... yield 2 # because it's a generator (line 10)
|
||||
Traceback (most recent call last):
|
||||
SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.syntax[24]>, line 8)
|
||||
SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.syntax[24]>, line 10)
|
||||
|
||||
This one caused a crash (see SF bug 567538):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue