mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
charmap encoders uses Py_UCS4, not Py_UNICODE
This commit is contained in:
parent
54e26c01b0
commit
22168998f5
1 changed files with 4 additions and 7 deletions
|
@ -7934,7 +7934,7 @@ PyUnicode_BuildEncodingMap(PyObject* string)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
struct encoding_map *map = (struct encoding_map*)mapping;
|
||||||
int l1 = c>>11;
|
int l1 = c>>11;
|
||||||
|
@ -7942,11 +7942,8 @@ encoding_map_lookup(Py_UNICODE c, PyObject *mapping)
|
||||||
int l3 = c & 0x7F;
|
int l3 = c & 0x7F;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef Py_UNICODE_WIDE
|
if (c > 0xFFFF)
|
||||||
if (c > 0xFFFF) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
return 0;
|
return 0;
|
||||||
/* level 1*/
|
/* 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
|
can't be found, Py_None is returned (or NULL, if another
|
||||||
error occurred). */
|
error occurred). */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
charmapencode_lookup(Py_UNICODE c, PyObject *mapping)
|
charmapencode_lookup(Py_UCS4 c, PyObject *mapping)
|
||||||
{
|
{
|
||||||
PyObject *w = PyLong_FromLong((long)c);
|
PyObject *w = PyLong_FromLong((long)c);
|
||||||
PyObject *x;
|
PyObject *x;
|
||||||
|
@ -8036,7 +8033,7 @@ typedef enum charmapencode_result {
|
||||||
(in which case no character was written) or NULL, if a
|
(in which case no character was written) or NULL, if a
|
||||||
reallocation error occurred. The caller must decref the result */
|
reallocation error occurred. The caller must decref the result */
|
||||||
static charmapencode_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 **outobj, Py_ssize_t *outpos)
|
||||||
{
|
{
|
||||||
PyObject *rep;
|
PyObject *rep;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue