Skip to content

Commit

Permalink
Make socket.sslerror a subclass of socket.error .
Browse files Browse the repository at this point in the history
Added socket.error to the socket module's C API.
  • Loading branch information
brettcannon committed Mar 23, 2004
1 parent fee6f33 commit 06c3479
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 3 additions & 1 deletion Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3559,6 +3559,7 @@ static
PySocketModule_APIObject PySocketModuleAPI =
{
&sock_type,
NULL
};


Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions Modules/socketmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 06c3479

Please sign in to comment.