mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #16147: PyUnicode_FromFormatV() now raises an error if the argument of
'%c' is not in the range(0x110000).
This commit is contained in:
parent
3921e90c5a
commit
ff5a848db5
1 changed files with 5 additions and 0 deletions
|
@ -2417,6 +2417,11 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
||||||
case 'c':
|
case 'c':
|
||||||
{
|
{
|
||||||
int ordinal = va_arg(*vargs, int);
|
int ordinal = va_arg(*vargs, int);
|
||||||
|
if (ordinal < 0 || ordinal > MAX_UNICODE) {
|
||||||
|
PyErr_SetString(PyExc_ValueError,
|
||||||
|
"character argument not in range(0x110000)");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (_PyUnicodeWriter_Prepare(writer, 1, ordinal) == -1)
|
if (_PyUnicodeWriter_Prepare(writer, 1, ordinal) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
PyUnicode_WRITE(writer->kind, writer->data, writer->pos, ordinal);
|
PyUnicode_WRITE(writer->kind, writer->data, writer->pos, ordinal);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue