mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
Issue #15379: Fix passing of non-BMP characters as integers for the charmap decoder (already working as unicode strings).
Patch by Serhiy Storchaka.
This commit is contained in:
commit
a1f7655fa7
3 changed files with 123 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue