summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2018-01-10 21:46:15 (GMT)
committerGitHub <noreply@github.com>2018-01-10 21:46:15 (GMT)
commit2cba6b85797ba60d67389126f184aad5c9e02ff3 (patch)
tree5cc0972b12e1c85e58c4ff57edc312882f107ff1 /Modules
parentf80c0ca13330112fe4d8018609c085ef556cb5bf (diff)
downloadcpython-2cba6b85797ba60d67389126f184aad5c9e02ff3.zip
cpython-2cba6b85797ba60d67389126f184aad5c9e02ff3.tar.gz
cpython-2cba6b85797ba60d67389126f184aad5c9e02ff3.tar.bz2
bpo-29240: readline now ignores the UTF-8 Mode (#5145)
Add new fuctions ignoring the UTF-8 mode: * _Py_DecodeCurrentLocale() * _Py_EncodeCurrentLocale() * _PyUnicode_DecodeCurrentLocaleAndSize() * _PyUnicode_EncodeCurrentLocale() Modify the readline module to use these functions. Re-enable test_readline.test_nonascii().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/readline.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 811fca8..8db4cfd 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -132,13 +132,14 @@ static PyModuleDef readlinemodule;
static PyObject *
encode(PyObject *b)
{
- return PyUnicode_EncodeLocale(b, "surrogateescape");
+ return _PyUnicode_EncodeCurrentLocale(b, "surrogateescape");
}
static PyObject *
decode(const char *s)
{
- return PyUnicode_DecodeLocale(s, "surrogateescape");
+ return _PyUnicode_DecodeCurrentLocaleAndSize(s, strlen(s),
+ "surrogateescape");
}