summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index c828d49..132d6c7 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -4032,9 +4032,8 @@ gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af)
if (h->h_addrtype != af) {
/* Let's get real error message to return */
- PyErr_SetString(PyExc_OSError,
- (char *)strerror(EAFNOSUPPORT));
-
+ errno = EAFNOSUPPORT;
+ PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}