diff Modules/socketmodule.c @ 53816:911df82bc25d

add a replacement API for PyCObject, PyCapsule #5630 All stdlib modules with C-APIs now use this. Patch by Larry Hastings
author Benjamin Peterson <benjamin@python.org>
date Tue, 05 May 2009 22:31:58 +0000
parents 8f51dd09f3f2
children b666e72f602f
line wrap: on
line diff
--- a/Modules/socketmodule.c	Tue May 05 22:14:50 2009 +0000
+++ b/Modules/socketmodule.c	Tue May 05 22:31:58 2009 +0000
@@ -4146,6 +4146,14 @@
         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 @@
 
 	/* 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;