mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Change formatchar(), so that u"%c" % 0xffffffff now raises
an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127.
This commit is contained in:
parent
7ba256f039
commit
44f527fea4
3 changed files with 5 additions and 4 deletions
|
@ -6157,14 +6157,14 @@ formatchar(Py_UNICODE *buf,
|
|||
goto onError;
|
||||
#ifdef Py_UNICODE_WIDE
|
||||
if (x < 0 || x > 0x10ffff) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"%c arg not in range(0x110000) "
|
||||
"(wide Python build)");
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
if (x < 0 || x > 0xffff) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"%c arg not in range(0x10000) "
|
||||
"(narrow Python build)");
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue