From 06c34798df6c99cf88ecab98bc7b7f78dfde3ff8 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Tue, 23 Mar 2004 23:16:54 +0000 Subject: Make socket.sslerror a subclass of socket.error . Added socket.error to the socket module's C API. --- Misc/NEWS | 3 +++ Modules/_ssl.c | 4 +++- Modules/socketmodule.c | 2 ++ Modules/socketmodule.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index be6984b..afd8ea6 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -195,6 +195,9 @@ Core and builtins Extension modules ----------------- +- socket.sslerror is now a subclass of socket.error . Also added + socket.error to the socket module's C API. + - Bug #920575: A problem that _locale module segfaults on nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5fcf84c..bee1040 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -609,7 +609,9 @@ init_ssl(void) SSLeay_add_ssl_algorithms(); /* Add symbols to module dict */ - PySSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL); + PySSLErrorObject = PyErr_NewException("socket.sslerror", + PySocketModule.error, + NULL); if (PySSLErrorObject == NULL) return; PyDict_SetItemString(d, "sslerror", PySSLErrorObject); diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 818d169..7beb1cf 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3559,6 +3559,7 @@ static PySocketModule_APIObject PySocketModuleAPI = { &sock_type, + NULL }; @@ -3596,6 +3597,7 @@ init_socket(void) socket_error = PyErr_NewException("socket.error", NULL, NULL); if (socket_error == NULL) return; + PySocketModuleAPI.error = socket_error; Py_INCREF(socket_error); PyModule_AddObject(m, "error", socket_error); socket_herror = PyErr_NewException("socket.herror", diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index e81b5b4..601c282 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -160,6 +160,7 @@ typedef struct { /* C API for usage by other Python modules */ typedef struct { PyTypeObject *Sock_Type; + PyObject *error; } PySocketModule_APIObject; /* XXX The net effect of the following appears to be to define a function -- cgit v0.12