summaryrefslogtreecommitdiffstats
path: root/Include
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 /Include
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 'Include')
-rw-r--r--Include/fileutils.h8
-rw-r--r--Include/unicodeobject.h10
2 files changed, 18 insertions, 0 deletions
diff --git a/Include/fileutils.h b/Include/fileutils.h
index d027e18..2527d84 100644
--- a/Include/fileutils.h
+++ b/Include/fileutils.h
@@ -24,6 +24,14 @@ PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape(
const char *s,
Py_ssize_t size,
size_t *p_wlen);
+
+PyAPI_FUNC(wchar_t *) _Py_DecodeCurrentLocale(
+ const char *arg,
+ size_t *size);
+
+PyAPI_FUNC(char*) _Py_EncodeCurrentLocale(
+ const wchar_t *text,
+ size_t *error_pos);
#endif
#ifndef Py_LIMITED_API
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 0274de6..576e7ad 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -1810,6 +1810,16 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale(
PyObject *unicode,
const char *errors
);
+
+PyAPI_FUNC(PyObject*) _PyUnicode_DecodeCurrentLocaleAndSize(
+ const char *str,
+ Py_ssize_t len,
+ const char *errors);
+
+PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCurrentLocale(
+ PyObject *unicode,
+ const char *errors
+ );
#endif
/* --- File system encoding ---------------------------------------------- */