mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #13560: os.strerror() now uses the current locale encoding instead of UTF-8
This commit is contained in:
parent
f2ea71fcc8
commit
1f33f2b0c3
5 changed files with 35 additions and 20 deletions
|
@ -7891,7 +7891,7 @@ posix_strerror(PyObject *self, PyObject *args)
|
|||
"strerror() argument out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyUnicode_FromString(message);
|
||||
return PyUnicode_DecodeLocale(message, 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue