mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-28 06:31:32 +03:00 
			
		
		
		
	py3k: Publish both frombytes and fromstring in C modules for old Python
To ease the transition, frombytes and tobytes need to be declared in both versions.
This commit is contained in:
		
							parent
							
								
									275a895952
								
							
						
					
					
						commit
						8b704e3005
					
				|  | @ -501,9 +501,8 @@ cms_get_display_profile_win32(PyObject* self, PyObject* args) | |||
| static PyMethodDef pyCMSdll_methods[] = { | ||||
| 
 | ||||
|     {"profile_open", cms_profile_open, 1}, | ||||
| #if PY_VERSION_HEX >= 0x03000000 | ||||
|     {"profile_frombytes", cms_profile_fromstring, 1}, | ||||
| #else | ||||
| #if PY_VERSION_HEX < 0x03000000 | ||||
|     {"profile_fromstring", cms_profile_fromstring, 1}, | ||||
| #endif | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										15
									
								
								display.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								display.c
									
									
									
									
									
								
							|  | @ -180,7 +180,7 @@ _releasedc(ImagingDisplayObject* display, PyObject* args) | |||
| } | ||||
| 
 | ||||
| static PyObject* | ||||
| _fromstring(ImagingDisplayObject* display, PyObject* args) | ||||
| _frombytes(ImagingDisplayObject* display, PyObject* args) | ||||
| { | ||||
|     char* ptr; | ||||
|     int bytes; | ||||
|  | @ -205,7 +205,7 @@ _fromstring(ImagingDisplayObject* display, PyObject* args) | |||
| } | ||||
| 
 | ||||
| static PyObject* | ||||
| _tostring(ImagingDisplayObject* display, PyObject* args) | ||||
| _tobytes(ImagingDisplayObject* display, PyObject* args) | ||||
| { | ||||
| #if PY_VERSION_HEX >= 0x03000000 | ||||
|     if (!PyArg_ParseTuple(args, ":tobytes")) | ||||
|  | @ -227,12 +227,11 @@ static struct PyMethodDef methods[] = { | |||
|     {"query_palette", (PyCFunction)_query_palette, 1}, | ||||
|     {"getdc", (PyCFunction)_getdc, 1}, | ||||
|     {"releasedc", (PyCFunction)_releasedc, 1}, | ||||
| #if PY_VERSION_HEX >= 0x03000000 | ||||
|     {"frombytes", (PyCFunction)_fromstring, 1}, | ||||
|     {"tobytes", (PyCFunction)_tostring, 1}, | ||||
| #else | ||||
|     {"fromstring", (PyCFunction)_fromstring, 1}, | ||||
|     {"tostring", (PyCFunction)_tostring, 1}, | ||||
|     {"frombytes", (PyCFunction)_frombytes, 1}, | ||||
|     {"tobytes", (PyCFunction)_tobytes, 1}, | ||||
| #if PY_VERSION_HEX < 0x03000000 | ||||
|     {"fromstring", (PyCFunction)_frombytes, 1}, | ||||
|     {"tostring", (PyCFunction)_tobytes, 1}, | ||||
| #endif | ||||
|     {NULL, NULL} /* sentinel */ | ||||
| }; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user