mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this. Patch by Larry Hastings
This commit is contained in:
		
							parent
							
								
									c679fd8efc
								
							
						
					
					
						commit
						b173f7853e
					
				
					 37 changed files with 943 additions and 149 deletions
				
			
		|  | @ -4146,6 +4146,14 @@ PySocketModule_APIObject PySocketModuleAPI = | |||
|         NULL | ||||
| }; | ||||
| 
 | ||||
| PySocketModule_APIObject * | ||||
| PySocketModule_ImportModuleAndAPI(void) | ||||
| { | ||||
| 	void *api; | ||||
| 	api = PyCapsule_Import(PySocket_CAPSULE_NAME, 1);; | ||||
| 	return (PySocketModule_APIObject *)api; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /* Initialize the _socket module.
 | ||||
| 
 | ||||
|  | @ -4231,7 +4239,7 @@ PyInit__socket(void) | |||
| 
 | ||||
| 	/* Export C API */ | ||||
| 	if (PyModule_AddObject(m, PySocket_CAPI_NAME, | ||||
| 	       PyCObject_FromVoidPtr((void *)&PySocketModuleAPI, NULL) | ||||
| 	       PyCapsule_New(&PySocketModuleAPI, PySocket_CAPSULE_NAME, NULL) | ||||
| 				 ) != 0) | ||||
| 		return NULL; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Benjamin Peterson
						Benjamin Peterson