mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +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 @@ | |||
| ...     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 @@ | |||
| ...         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
	
	 Georg Brandl
						Georg Brandl