From 4216dce04b7d3f329beaaafc82a77c4ac6cf4d57 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 4 Apr 2022 11:46:57 +0900 Subject: bpo-47000: Make `io.text_encoding()` respects UTF-8 mode (GH-32003) Co-authored-by: Eric Snow --- Python/sysmodule.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 5765e9ef657..de4e10a7e11 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -841,7 +841,10 @@ static PyObject * sys_getdefaultencoding_impl(PyObject *module) /*[clinic end generated code: output=256d19dfcc0711e6 input=d416856ddbef6909]*/ { - return PyUnicode_FromString(PyUnicode_GetDefaultEncoding()); + _Py_DECLARE_STR(utf_8, "utf-8"); + PyObject *ret = &_Py_STR(utf_8); + Py_INCREF(ret); + return ret; } /*[clinic input] -- cgit v1.2.3