summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-09-23 18:00:04 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-09-23 18:00:04 (GMT)
commita1f7655fa7e09ec33a240e4e2f589bca2eac76e0 (patch)
tree69af12cefa3b52cf342fc4c7841fc13a4426b006 /Objects
parent5011244be0f12ab51ca318bdc409d5df5f8c7914 (diff)
parent6f80f5d4446f06d15274ad519cae6929a3565cc0 (diff)
downloadcpython-a1f7655fa7e09ec33a240e4e2f589bca2eac76e0.zip
cpython-a1f7655fa7e09ec33a240e4e2f589bca2eac76e0.tar.gz
cpython-a1f7655fa7e09ec33a240e4e2f589bca2eac76e0.tar.bz2
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')
-rw-r--r--Objects/unicodeobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 748508b..0da565a 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;
}