mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	All calls to getarrayitem() (which is static) are done either in loops
over the size of the array, or the callers check the index bounds themselves, so the index check never failed => Replace it with an assert().
This commit is contained in:
		
							parent
							
								
									4ec4fa208e
								
							
						
					
					
						commit
						8bb1ae9c34
					
				
					 1 changed files with 1 additions and 4 deletions
				
			
		|  | @ -447,10 +447,7 @@ getarrayitem(PyObject *op, int i) | |||
| 	register arrayobject *ap; | ||||
| 	assert(array_Check(op)); | ||||
| 	ap = (arrayobject *)op; | ||||
| 	if (i < 0 || i >= ap->ob_size) { | ||||
| 		PyErr_SetString(PyExc_IndexError, "array index out of range"); | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	assert(i>=0 && i<ap->ob_size); | ||||
| 	return (*ap->ob_descr->getitem)(ap, i); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Walter Dörwald
						Walter Dörwald