Issue #13560: os.strerror() now uses the current locale encoding instead of UTF-8
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 @@
 
     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;
     }