diff Modules/socketmodule.c @ 74007:51412b4b81ae

Issue #13560: os.strerror() now uses the current locale encoding instead of UTF-8
author Victor Stinner <victor.stinner@haypocalc.com>
date Sat, 17 Dec 2011 04:45:09 +0100
parents 1f23bb74f4bc
children 59ea1d1a4137
line wrap: on
line diff
--- a/Modules/socketmodule.c	Sat Dec 17 04:13:41 2011 +0100
+++ b/Modules/socketmodule.c	Sat Dec 17 04:45:09 2011 +0100
@@ -4032,9 +4032,8 @@
 
     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;
     }