mirror of https://github.com/python/cpython
(Merge 3.3) 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.
This commit is contained in:
commit
0b81111b18
|
@ -103,6 +103,10 @@ Core and Builtins
|
|||
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 #18089: Implement importlib.abc.InspectLoader.load_module.
|
||||
|
||||
- Issue #18088: Introduce importlib.abc.Loader.init_module_attrs for setting
|
||||
|
|
|
@ -4257,7 +4257,7 @@ posix_uname(PyObject *self, PyObject *noargs)
|
|||
|
||||
#define SET(i, field) \
|
||||
{ \
|
||||
PyObject *o = PyUnicode_DecodeASCII(field, strlen(field), NULL); \
|
||||
PyObject *o = PyUnicode_DecodeFSDefault(field); \
|
||||
if (!o) { \
|
||||
Py_DECREF(value); \
|
||||
return NULL; \
|
||||
|
|
|
@ -4048,7 +4048,7 @@ socket_gethostname(PyObject *self, PyObject *unused)
|
|||
if (res < 0)
|
||||
return set_error();
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
return PyUnicode_FromString(buf);
|
||||
return PyUnicode_DecodeFSDefault(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue