mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
a non-ASCII byte in the format string. Document also the encoding.
This commit is contained in:
parent
cd419abe42
commit
1205f2774e
8 changed files with 53 additions and 6 deletions
|
@ -1102,7 +1102,15 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
appendstring(p);
|
||||
goto end;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else if (128 <= (unsigned char)*f) {
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"PyUnicode_FromFormatV() expects an ASCII-encoded format "
|
||||
"string, got a non-ascii byte: 0x%02x",
|
||||
(unsigned char)*f);
|
||||
goto fail;
|
||||
}
|
||||
else
|
||||
*s++ = *f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue