summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2022-04-04 02:46:57 (GMT)
committerGitHub <noreply@github.com>2022-04-04 02:46:57 (GMT)
commit4216dce04b7d3f329beaaafc82a77c4ac6cf4d57 (patch)
treeb3ff3df025ddb3c383beb156fd150df62d40ac8e /Python
parent6db2db91b96aaa1270c200ec931a2250fe2799c7 (diff)
downloadcpython-4216dce04b7d3f329beaaafc82a77c4ac6cf4d57.zip
cpython-4216dce04b7d3f329beaaafc82a77c4ac6cf4d57.tar.gz
cpython-4216dce04b7d3f329beaaafc82a77c4ac6cf4d57.tar.bz2
bpo-47000: Make `io.text_encoding()` respects UTF-8 mode (GH-32003)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/sysmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 5765e9e..de4e10a 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]