summaryrefslogtreecommitdiff
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2018-01-10 22:46:15 +0100
committerGitHub <noreply@github.com>2018-01-10 22:46:15 +0100
commit2cba6b85797ba60d67389126f184aad5c9e02ff3 (patch)
tree5cc0972b12e1c85e58c4ff57edc312882f107ff1 /Modules/readline.c
parentf80c0ca13330112fe4d8018609c085ef556cb5bf (diff)
downloadcpython-git-2cba6b85797ba60d67389126f184aad5c9e02ff3.tar.gz
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/readline.c')
-rw-r--r--Modules/readline.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 811fca8cd9..8db4cfd015 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");
}