From 2cba6b85797ba60d67389126f184aad5c9e02ff3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 10 Jan 2018 22:46:15 +0100 Subject: 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(). --- Modules/readline.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Modules/readline.c') 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"); } -- cgit v1.2.1