From b173f7853e4e3a4215a661d98174291e379cf6fb Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 5 May 2009 22:31:58 +0000 Subject: add a replacement API for PyCObject, PyCapsule #5630 All stdlib modules with C-APIs now use this. Patch by Larry Hastings --- Modules/socketmodule.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Modules/socketmodule.c') diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index c229c07252..6ec522011b 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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; -- cgit v1.2.1