mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Convert list to tuple in Python instead of C
This commit is contained in:
		
							parent
							
								
									d8c3135b6b
								
							
						
					
					
						commit
						69a81dd867
					
				| 
						 | 
				
			
			@ -1565,6 +1565,8 @@ class Image:
 | 
			
		|||
        self.load()
 | 
			
		||||
        if self.pyaccess:
 | 
			
		||||
            return self.pyaccess.getpixel(xy)
 | 
			
		||||
        if isinstance(xy, list):
 | 
			
		||||
            xy = tuple(xy)
 | 
			
		||||
        return self.im.getpixel(xy)
 | 
			
		||||
 | 
			
		||||
    def getprojection(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1146,15 +1146,11 @@ static inline int
 | 
			
		|||
_getxy(PyObject *xy, int *x, int *y) {
 | 
			
		||||
    PyObject *value;
 | 
			
		||||
 | 
			
		||||
    int tuple = PyTuple_Check(xy);
 | 
			
		||||
    if (
 | 
			
		||||
      !(tuple && PyTuple_GET_SIZE(xy) == 2) &&
 | 
			
		||||
      !(PyList_Check(xy) && PyList_GET_SIZE(xy) == 2)
 | 
			
		||||
    ) {
 | 
			
		||||
    if (!PyTuple_Check(xy) || PyTuple_GET_SIZE(xy) != 2) {
 | 
			
		||||
        goto badarg;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    value = tuple ? PyTuple_GET_ITEM(xy, 0) : PyList_GET_ITEM(xy, 0);
 | 
			
		||||
    value = PyTuple_GET_ITEM(xy, 0);
 | 
			
		||||
    if (PyLong_Check(value)) {
 | 
			
		||||
        *x = PyLong_AS_LONG(value);
 | 
			
		||||
    } else if (PyFloat_Check(value)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1168,7 +1164,7 @@ _getxy(PyObject *xy, int *x, int *y) {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    value = tuple ? PyTuple_GET_ITEM(xy, 1) : PyList_GET_ITEM(xy, 1);
 | 
			
		||||
    value = PyTuple_GET_ITEM(xy, 1);
 | 
			
		||||
    if (PyLong_Check(value)) {
 | 
			
		||||
        *y = PyLong_AS_LONG(value);
 | 
			
		||||
    } else if (PyFloat_Check(value)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user