diff Modules/_ssl.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 b421441ee679
children f94c09aa4444
line wrap: on
line diff
--- a/Modules/_ssl.c	Tue May 05 22:14:50 2009 +0000
+++ b/Modules/_ssl.c	Tue May 05 22:31:58 2009 +0000
@@ -71,6 +71,8 @@
 /* Include symbols from _socket module */
 #include "socketmodule.h"
 
+static PySocketModule_APIObject PySocketModule;
+
 #if defined(HAVE_POLL_H)
 #include <poll.h>
 #elif defined(HAVE_SYS_POLL_H)
@@ -1626,6 +1628,7 @@
 PyInit__ssl(void)
 {
 	PyObject *m, *d;
+        PySocketModule_APIObject *socket_api;
 
 	if (PyType_Ready(&PySSL_Type) < 0)
 		return NULL;
@@ -1636,8 +1639,10 @@
 	d = PyModule_GetDict(m);
 
 	/* Load _socket module and its C API */
-	if (PySocketModule_ImportModuleAndAPI())
+        socket_api = PySocketModule_ImportModuleAndAPI();
+	if (!socket_api)
 		return NULL;
+        PySocketModule = *socket_api;
 
 	/* Init OpenSSL */
 	SSL_load_error_strings();