mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Simplify %U handling by using Py_UNICODE_COPY.
This commit is contained in:
parent
1d0476b2a2
commit
5c2fab6e23
1 changed files with 3 additions and 5 deletions
|
@ -690,11 +690,9 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
case 'U':
|
||||
{
|
||||
PyObject *obj = va_arg(vargs, PyObject *);
|
||||
Py_UNICODE *ucopy = PyUnicode_AS_UNICODE(obj);
|
||||
Py_ssize_t usize = PyUnicode_GET_SIZE(obj);
|
||||
Py_ssize_t upos;
|
||||
for (upos = 0; upos<usize;)
|
||||
*s++ = ucopy[upos++];
|
||||
Py_ssize_t size = PyUnicode_GET_SIZE(obj);
|
||||
Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size);
|
||||
s += size;
|
||||
break;
|
||||
}
|
||||
case 'S':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue