mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Merged revisions 75223 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75223 | benjamin.peterson | 2009-10-03 15:23:24 -0500 (Sat, 03 Oct 2009) | 1 line #7050 fix a SystemError when using tuple unpacking and augmented assignment ........
This commit is contained in:
		
							parent
							
								
									8504d085b7
								
							
						
					
					
						commit
						bd27aef8a0
					
				
					 2 changed files with 16 additions and 0 deletions
				
			
		|  | @ -19,6 +19,9 @@ def testBasic(self): | ||||||
|         x /= 2 |         x /= 2 | ||||||
|         self.assertEquals(x, 3.0) |         self.assertEquals(x, 3.0) | ||||||
| 
 | 
 | ||||||
|  |     def test_with_unpacking(self): | ||||||
|  |         self.assertRaises(SyntaxError, compile, "x, b += 3", "<test>", "exec") | ||||||
|  | 
 | ||||||
|     def testInList(self): |     def testInList(self): | ||||||
|         x = [2] |         x = [2] | ||||||
|         x[0] += 1 |         x[0] += 1 | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								Python/ast.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								Python/ast.c
									
										
									
									
									
								
							|  | @ -2115,6 +2115,19 @@ ast_for_expr_stmt(struct compiling *c, const node *n) | ||||||
|             return NULL; |             return NULL; | ||||||
|         if(!set_context(c, expr1, Store, ch)) |         if(!set_context(c, expr1, Store, ch)) | ||||||
|             return NULL; |             return NULL; | ||||||
|  |         /* set_context checks that most expressions are not the left side.
 | ||||||
|  |           Augmented assignments can only have a name, a subscript, or an | ||||||
|  |           attribute on the left, though, so we have to explicitly check for | ||||||
|  |           those. */ | ||||||
|  |         switch (expr1->kind) { | ||||||
|  |             case Name_kind: | ||||||
|  |             case Attribute_kind: | ||||||
|  |             case Subscript_kind: | ||||||
|  |                 break; | ||||||
|  |             default: | ||||||
|  |                 ast_error(ch, "illegal expression for augmented assignment"); | ||||||
|  |                 return NULL; | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         ch = CHILD(n, 2); |         ch = CHILD(n, 2); | ||||||
|         if (TYPE(ch) == testlist) |         if (TYPE(ch) == testlist) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Benjamin Peterson
						Benjamin Peterson