mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	make too many nested blocks be a SyntaxError instead of a SystemError (closes #27514)
Patch by Ammar Askar.
This commit is contained in:
		
							parent
							
								
									2b8792137b
								
							
						
					
					
						commit
						e09ed5419b
					
				
					 3 changed files with 8 additions and 3 deletions
				
			
		|  | @ -342,7 +342,9 @@ | ||||||
|      ... |      ... | ||||||
|    SyntaxError: 'break' outside loop |    SyntaxError: 'break' outside loop | ||||||
| 
 | 
 | ||||||
| This should probably raise a better error than a SystemError (or none at all). | This raises a SyntaxError, it used to raise a SystemError. | ||||||
|  | Context for this change can be found on issue #27514 | ||||||
|  | 
 | ||||||
| In 2.5 there was a missing exception and an assert was triggered in a debug | In 2.5 there was a missing exception and an assert was triggered in a debug | ||||||
| build.  The number of blocks must be greater than CO_MAXBLOCKS.  SF #1565514 | build.  The number of blocks must be greater than CO_MAXBLOCKS.  SF #1565514 | ||||||
| 
 | 
 | ||||||
|  | @ -370,7 +372,7 @@ | ||||||
|    ...                      break |    ...                      break | ||||||
|    Traceback (most recent call last): |    Traceback (most recent call last): | ||||||
|      ... |      ... | ||||||
|    SystemError: too many statically nested blocks |    SyntaxError: too many statically nested blocks | ||||||
| 
 | 
 | ||||||
| Misuse of the nonlocal statement can lead to a few unique syntax errors. | Misuse of the nonlocal statement can lead to a few unique syntax errors. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,6 +10,9 @@ Release date: TBA | ||||||
| Core and Builtins | Core and Builtins | ||||||
| ----------------- | ----------------- | ||||||
| 
 | 
 | ||||||
|  | - Issue #27514: Make having too many statically nested blocks a SyntaxError | ||||||
|  |   instead of SystemError. | ||||||
|  | 
 | ||||||
| - Issue #27473: Fixed possible integer overflow in bytes and bytearray | - Issue #27473: Fixed possible integer overflow in bytes and bytearray | ||||||
|   concatenations.  Patch by Xiang Zhang. |   concatenations.  Patch by Xiang Zhang. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3980,7 +3980,7 @@ compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b) | ||||||
| { | { | ||||||
|     struct fblockinfo *f; |     struct fblockinfo *f; | ||||||
|     if (c->u->u_nfblocks >= CO_MAXBLOCKS) { |     if (c->u->u_nfblocks >= CO_MAXBLOCKS) { | ||||||
|         PyErr_SetString(PyExc_SystemError, |         PyErr_SetString(PyExc_SyntaxError, | ||||||
|                         "too many statically nested blocks"); |                         "too many statically nested blocks"); | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Benjamin Peterson
						Benjamin Peterson