diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-08-04 22:32:03 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-08-04 22:32:03 (GMT) |
commit | 864e9ffb14fcd569089f78fca065464c4e8cb3f2 (patch) | |
tree | c9fd4f7afb45fab85c6911093de4dd9abe92a4cc /Modules | |
parent | c9908c4f5c7f22d241538db13bd9fc0fea4cc9b8 (diff) | |
download | cpython-864e9ffb14fcd569089f78fca065464c4e8cb3f2.zip cpython-864e9ffb14fcd569089f78fca065464c4e8cb3f2.tar.gz cpython-864e9ffb14fcd569089f78fca065464c4e8cb3f2.tar.bz2 |
Auto-detect hstrerror. Raise socket.herror in PyH_Error. Register the three
exception classes in the module dictionary.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/socketmodule.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index e6a9ec8..41dd2c4 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -431,7 +431,7 @@ PyH_Err(int h_error) v = Py_BuildValue("(is)", h_error, "host not found"); #endif if (v != NULL) { - PyErr_SetObject(PyGAI_Error, v); + PyErr_SetObject(PyH_Error, v); Py_DECREF(v); } @@ -2915,13 +2915,16 @@ init_socket(void) PySocket_Error = PyErr_NewException("socket.error", NULL, NULL); if (PySocket_Error == NULL) return; + PyDict_SetItemString(d, "error", PySocket_Error); PyH_Error = PyErr_NewException("socket.herror", PySocket_Error, NULL); if (PyH_Error == NULL) return; + PyDict_SetItemString(d, "herror", PyH_Error); PyGAI_Error = PyErr_NewException("socket.gaierror", PySocket_Error, NULL); if (PyGAI_Error == NULL) return; + PyDict_SetItemString(d, "gaierror", PyGAI_Error); #ifdef USE_SSL SSL_load_error_strings(); SSLeay_add_ssl_algorithms(); @@ -2934,7 +2937,6 @@ init_socket(void) (PyObject *)&SSL_Type) != 0) return; #endif /* USE_SSL */ - PyDict_SetItemString(d, "error", PySocket_Error); PySocketSock_Type.ob_type = &PyType_Type; PySocketSock_Type.tp_doc = sockettype_doc; Py_INCREF(&PySocketSock_Type); |