add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this.
Patch by Larry Hastings
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index c229c07..6ec5220 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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;