mirror of
https://github.com/python/cpython.git
synced 2024-11-26 19:34:19 +08:00
Auto-detect hstrerror. Raise socket.herror in PyH_Error. Register the three
exception classes in the module dictionary.
This commit is contained in:
parent
c9908c4f5c
commit
864e9ffb14
@ -431,7 +431,7 @@ PyH_Err(int h_error)
|
|||||||
v = Py_BuildValue("(is)", h_error, "host not found");
|
v = Py_BuildValue("(is)", h_error, "host not found");
|
||||||
#endif
|
#endif
|
||||||
if (v != NULL) {
|
if (v != NULL) {
|
||||||
PyErr_SetObject(PyGAI_Error, v);
|
PyErr_SetObject(PyH_Error, v);
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2915,13 +2915,16 @@ init_socket(void)
|
|||||||
PySocket_Error = PyErr_NewException("socket.error", NULL, NULL);
|
PySocket_Error = PyErr_NewException("socket.error", NULL, NULL);
|
||||||
if (PySocket_Error == NULL)
|
if (PySocket_Error == NULL)
|
||||||
return;
|
return;
|
||||||
|
PyDict_SetItemString(d, "error", PySocket_Error);
|
||||||
PyH_Error = PyErr_NewException("socket.herror", PySocket_Error, NULL);
|
PyH_Error = PyErr_NewException("socket.herror", PySocket_Error, NULL);
|
||||||
if (PyH_Error == NULL)
|
if (PyH_Error == NULL)
|
||||||
return;
|
return;
|
||||||
|
PyDict_SetItemString(d, "herror", PyH_Error);
|
||||||
PyGAI_Error = PyErr_NewException("socket.gaierror", PySocket_Error,
|
PyGAI_Error = PyErr_NewException("socket.gaierror", PySocket_Error,
|
||||||
NULL);
|
NULL);
|
||||||
if (PyGAI_Error == NULL)
|
if (PyGAI_Error == NULL)
|
||||||
return;
|
return;
|
||||||
|
PyDict_SetItemString(d, "gaierror", PyGAI_Error);
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
SSLeay_add_ssl_algorithms();
|
SSLeay_add_ssl_algorithms();
|
||||||
@ -2934,7 +2937,6 @@ init_socket(void)
|
|||||||
(PyObject *)&SSL_Type) != 0)
|
(PyObject *)&SSL_Type) != 0)
|
||||||
return;
|
return;
|
||||||
#endif /* USE_SSL */
|
#endif /* USE_SSL */
|
||||||
PyDict_SetItemString(d, "error", PySocket_Error);
|
|
||||||
PySocketSock_Type.ob_type = &PyType_Type;
|
PySocketSock_Type.ob_type = &PyType_Type;
|
||||||
PySocketSock_Type.tp_doc = sockettype_doc;
|
PySocketSock_Type.tp_doc = sockettype_doc;
|
||||||
Py_INCREF(&PySocketSock_Type);
|
Py_INCREF(&PySocketSock_Type);
|
||||||
|
4
configure
vendored
4
configure
vendored
@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# From configure.in Revision: 1.236
|
# From configure.in Revision: 1.237
|
||||||
|
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated automatically using autoconf version 2.13
|
# Generated automatically using autoconf version 2.13
|
||||||
@ -4518,7 +4518,7 @@ echo "$ac_t""$DYNLOADFILE" 1>&6
|
|||||||
for ac_func in alarm chown clock confstr ctermid ctermid_r execv \
|
for ac_func in alarm chown clock confstr ctermid ctermid_r execv \
|
||||||
flock fork fsync fdatasync fpathconf ftime ftruncate \
|
flock fork fsync fdatasync fpathconf ftime ftruncate \
|
||||||
getgroups getlogin getpeername getpid getpwent getwd \
|
getgroups getlogin getpeername getpid getpwent getwd \
|
||||||
inet_pton kill link lstat mkfifo mktime mremap \
|
hstrerror inet_pton kill link lstat mkfifo mktime mremap \
|
||||||
nice pathconf pause plock poll pthread_init \
|
nice pathconf pause plock poll pthread_init \
|
||||||
putenv readlink \
|
putenv readlink \
|
||||||
select setegid seteuid setgid \
|
select setegid seteuid setgid \
|
||||||
|
@ -1178,7 +1178,7 @@ AC_MSG_RESULT($DYNLOADFILE)
|
|||||||
AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
|
AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
|
||||||
flock fork fsync fdatasync fpathconf ftime ftruncate \
|
flock fork fsync fdatasync fpathconf ftime ftruncate \
|
||||||
getgroups getlogin getpeername getpid getpwent getwd \
|
getgroups getlogin getpeername getpid getpwent getwd \
|
||||||
inet_pton kill link lstat mkfifo mktime mremap \
|
hstrerror inet_pton kill link lstat mkfifo mktime mremap \
|
||||||
nice pathconf pause plock poll pthread_init \
|
nice pathconf pause plock poll pthread_init \
|
||||||
putenv readlink \
|
putenv readlink \
|
||||||
select setegid seteuid setgid \
|
select setegid seteuid setgid \
|
||||||
|
@ -410,6 +410,9 @@
|
|||||||
/* Define if you have the getwd function. */
|
/* Define if you have the getwd function. */
|
||||||
#undef HAVE_GETWD
|
#undef HAVE_GETWD
|
||||||
|
|
||||||
|
/* Define if you have the hstrerror function. */
|
||||||
|
#undef HAVE_HSTRERROR
|
||||||
|
|
||||||
/* Define if you have the hypot function. */
|
/* Define if you have the hypot function. */
|
||||||
#undef HAVE_HYPOT
|
#undef HAVE_HYPOT
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user