Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06c3479

Browse files
committed
Make socket.sslerror a subclass of socket.error .
Added socket.error to the socket module's C API.
1 parent fee6f33 commit 06c3479

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ Core and builtins
195195
Extension modules
196196
-----------------
197197

198+
- socket.sslerror is now a subclass of socket.error . Also added
199+
socket.error to the socket module's C API.
200+
198201
- Bug #920575: A problem that _locale module segfaults on
199202
nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed.
200203

Modules/_ssl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,9 @@ init_ssl(void)
609609
SSLeay_add_ssl_algorithms();
610610

611611
/* Add symbols to module dict */
612-
PySSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL);
612+
PySSLErrorObject = PyErr_NewException("socket.sslerror",
613+
PySocketModule.error,
614+
NULL);
613615
if (PySSLErrorObject == NULL)
614616
return;
615617
PyDict_SetItemString(d, "sslerror", PySSLErrorObject);

Modules/socketmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3559,6 +3559,7 @@ static
35593559
PySocketModule_APIObject PySocketModuleAPI =
35603560
{
35613561
&sock_type,
3562+
NULL
35623563
};
35633564

35643565

@@ -3596,6 +3597,7 @@ init_socket(void)
35963597
socket_error = PyErr_NewException("socket.error", NULL, NULL);
35973598
if (socket_error == NULL)
35983599
return;
3600+
PySocketModuleAPI.error = socket_error;
35993601
Py_INCREF(socket_error);
36003602
PyModule_AddObject(m, "error", socket_error);
36013603
socket_herror = PyErr_NewException("socket.herror",

Modules/socketmodule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ typedef struct {
160160
/* C API for usage by other Python modules */
161161
typedef struct {
162162
PyTypeObject *Sock_Type;
163+
PyObject *error;
163164
} PySocketModule_APIObject;
164165

165166
/* XXX The net effect of the following appears to be to define a function

0 commit comments

Comments
 (0)