diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-20 16:09:18 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-20 16:09:18 (GMT) |
commit | 22168998f5431effa9bd3942f29a155dad1a1545 (patch) | |
tree | d45dca3a7f96fb6fc7b54aca1b67bc0b8b647135 | |
parent | 54e26c01b01430b31e79563366c45ae5aca09aac (diff) | |
download | cpython-22168998f5431effa9bd3942f29a155dad1a1545.zip cpython-22168998f5431effa9bd3942f29a155dad1a1545.tar.gz cpython-22168998f5431effa9bd3942f29a155dad1a1545.tar.bz2 |
charmap encoders uses Py_UCS4, not Py_UNICODE
-rw-r--r-- | Objects/unicodeobject.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index b986193..b0b9528 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7934,7 +7934,7 @@ PyUnicode_BuildEncodingMap(PyObject* string) } static int -encoding_map_lookup(Py_UNICODE c, PyObject *mapping) +encoding_map_lookup(Py_UCS4 c, PyObject *mapping) { struct encoding_map *map = (struct encoding_map*)mapping; int l1 = c>>11; @@ -7942,11 +7942,8 @@ encoding_map_lookup(Py_UNICODE c, PyObject *mapping) int l3 = c & 0x7F; int i; -#ifdef Py_UNICODE_WIDE - if (c > 0xFFFF) { + if (c > 0xFFFF) return -1; - } -#endif if (c == 0) return 0; /* level 1*/ @@ -7971,7 +7968,7 @@ encoding_map_lookup(Py_UNICODE c, PyObject *mapping) can't be found, Py_None is returned (or NULL, if another error occurred). */ static PyObject * -charmapencode_lookup(Py_UNICODE c, PyObject *mapping) +charmapencode_lookup(Py_UCS4 c, PyObject *mapping) { PyObject *w = PyLong_FromLong((long)c); PyObject *x; @@ -8036,7 +8033,7 @@ typedef enum charmapencode_result { (in which case no character was written) or NULL, if a reallocation error occurred. The caller must decref the result */ static charmapencode_result -charmapencode_output(Py_UNICODE c, PyObject *mapping, +charmapencode_output(Py_UCS4 c, PyObject *mapping, PyObject **outobj, Py_ssize_t *outpos) { PyObject *rep; |