mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	[3.9] bpo-41119: Output correct error message for list/tuple followed by colon (GH-21160) (GH-21172)
(cherry picked from commit 4b85e60601)
			
			
This commit is contained in:
		
							parent
							
								
									f925407a19
								
							
						
					
					
						commit
						d01a3e76ee
					
				
					 2 changed files with 464 additions and 500 deletions
				
			
		|  | @ -648,11 +648,11 @@ invalid_named_expression: | ||||||
|         RAISE_SYNTAX_ERROR_KNOWN_LOCATION( |         RAISE_SYNTAX_ERROR_KNOWN_LOCATION( | ||||||
|             a, "cannot use assignment expressions with %s", _PyPegen_get_expr_name(a)) } |             a, "cannot use assignment expressions with %s", _PyPegen_get_expr_name(a)) } | ||||||
| invalid_assignment: | invalid_assignment: | ||||||
|     | a=list ':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "only single target (not list) can be annotated") } |     | a=list ':' expression { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "only single target (not list) can be annotated") } | ||||||
|     | a=tuple ':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "only single target (not tuple) can be annotated") } |     | a=tuple ':' expression { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "only single target (not tuple) can be annotated") } | ||||||
|     | a=star_named_expression ',' star_named_expressions* ':' { |     | a=star_named_expression ',' star_named_expressions* ':' expression { | ||||||
|         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "only single target (not tuple) can be annotated") } |         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "only single target (not tuple) can be annotated") } | ||||||
|     | a=expression ':' expression ['=' annotated_rhs] { |     | a=expression ':' expression { | ||||||
|         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "illegal target for annotation") } |         RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "illegal target for annotation") } | ||||||
|     | (star_targets '=')* a=star_expressions '=' { |     | (star_targets '=')* a=star_expressions '=' { | ||||||
|         RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) } |         RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) } | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lysandros Nikolaou
						Lysandros Nikolaou