mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-01 00:17:27 +03:00 
			
		
		
		
	Only call PyTuple_Check once in getink
This commit is contained in:
		
							parent
							
								
									d84e227204
								
							
						
					
					
						commit
						59d67fa68a
					
				|  | @ -502,12 +502,9 @@ getink(PyObject *color, Imaging im, char *ink) { | |||
|        be cast to either UINT8 or INT32 */ | ||||
| 
 | ||||
|     int rIsInt = 0; | ||||
|     int tupleSize = 0; | ||||
|     if (PyTuple_Check(color)) { | ||||
|         tupleSize = PyTuple_GET_SIZE(color); | ||||
|         if (tupleSize == 1) { | ||||
|             color = PyTuple_GetItem(color, 0); | ||||
|         } | ||||
|     int tupleSize = PyTuple_Check(color) ? PyTuple_GET_SIZE(color) : -1; | ||||
|     if (tupleSize == 1) { | ||||
|         color = PyTuple_GetItem(color, 0); | ||||
|     } | ||||
|     if (im->type == IMAGING_TYPE_UINT8 || im->type == IMAGING_TYPE_INT32 || | ||||
|         im->type == IMAGING_TYPE_SPECIAL) { | ||||
|  | @ -521,7 +518,7 @@ getink(PyObject *color, Imaging im, char *ink) { | |||
|             PyErr_SetString( | ||||
|                 PyExc_TypeError, "color must be int or single-element tuple"); | ||||
|             return NULL; | ||||
|         } else if (!PyTuple_Check(color)) { | ||||
|         } else if (tupleSize == -1) { | ||||
|             PyErr_SetString(PyExc_TypeError, "color must be int or tuple"); | ||||
|             return NULL; | ||||
|         } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user