diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-09-23 20:00:04 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-09-23 20:00:04 +0200 |
commit | a1f7655fa7e09ec33a240e4e2f589bca2eac76e0 (patch) | |
tree | 69af12cefa3b52cf342fc4c7841fc13a4426b006 /Objects/unicodeobject.c | |
parent | 5011244be0f12ab51ca318bdc409d5df5f8c7914 (diff) | |
parent | 6f80f5d4446f06d15274ad519cae6929a3565cc0 (diff) | |
download | cpython-git-a1f7655fa7e09ec33a240e4e2f589bca2eac76e0.tar.gz |
Issue #15379: Fix passing of non-BMP characters as integers for the charmap decoder (already working as unicode strings).
Patch by Serhiy Storchaka.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 748508b278..0da565a612 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7525,9 +7525,10 @@ Error: /* Apply mapping */ if (PyLong_Check(x)) { long value = PyLong_AS_LONG(x); - if (value < 0 || value > 65535) { - PyErr_SetString(PyExc_TypeError, - "character mapping must be in range(65536)"); + if (value < 0 || value > MAX_UNICODE) { + PyErr_Format(PyExc_TypeError, + "character mapping must be in range(0x%lx)", + (unsigned long)MAX_UNICODE + 1); Py_DECREF(x); goto onError; } |