Commit 657ea278 authored by Victor Stinner's avatar Victor Stinner

Close #18109: os.uname() now decodes fields from the locale encoding, and

socket.gethostname() now decodes the hostname from the locale encoding, instead
of using the UTF-8 encoding in strict mode.
parent 96190eeb
...@@ -24,6 +24,10 @@ Core and Builtins ...@@ -24,6 +24,10 @@ Core and Builtins
Library Library
------- -------
- Issue #18109: os.uname() now decodes fields from the locale encoding, and
socket.gethostname() now decodes the hostname from the locale encoding,
instead of using the UTF-8 encoding in strict mode.
- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to - Issue #17403: urllib.parse.robotparser normalizes the urls before adding to
ruleline. This helps in handling certain types invalid urls in a conservative ruleline. This helps in handling certain types invalid urls in a conservative
manner. manner.
......
...@@ -4514,7 +4514,7 @@ posix_uname(PyObject *self, PyObject *noargs) ...@@ -4514,7 +4514,7 @@ posix_uname(PyObject *self, PyObject *noargs)
#define SET(i, field) \ #define SET(i, field) \
{ \ { \
PyObject *o = PyUnicode_DecodeASCII(field, strlen(field), NULL); \ PyObject *o = PyUnicode_DecodeFSDefault(field); \
if (!o) { \ if (!o) { \
Py_DECREF(value); \ Py_DECREF(value); \
return NULL; \ return NULL; \
......
...@@ -4111,7 +4111,7 @@ socket_gethostname(PyObject *self, PyObject *unused) ...@@ -4111,7 +4111,7 @@ socket_gethostname(PyObject *self, PyObject *unused)
if (res < 0) if (res < 0)
return set_error(); return set_error();
buf[sizeof buf - 1] = '\0'; buf[sizeof buf - 1] = '\0';
return PyUnicode_FromString(buf); return PyUnicode_DecodeFSDefault(buf);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment