cpython: 4b98ce6ef95e (original) (raw)
Mercurial > cpython
changeset 76705:4b98ce6ef95e
Issue #14687: Optimize str%args * formatfloat() uses unicode_fromascii() instead of PyUnicode_DecodeASCII() to not have to check characters, we know that it is really ASCII * Use PyUnicode_FromOrdinal() instead of _PyUnicode_FromUCS4() to format a character: if avoids a call to ucs4lib_find_max_char() to compute the maximum character (whereas we already know it, it is just the character itself) [#14687]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Wed, 02 May 2012 00:29:36 +0200 |
parents | 9ea07e65ed2a |
children | a966f9311ebb |
files | Objects/unicodeobject.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-)[+] [-] Objects/unicodeobject.c 4 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13431,7 +13431,7 @@ formatfloat(PyObject *v, int flags, int (flags & F_ALT) ? Py_DTSF_ALT : 0, NULL); if (p == NULL) return NULL;
@@ -13947,7 +13947,7 @@ PyUnicode_Format(PyObject *format, PyObj Py_UCS4 ch = formatchar(v); if (ch == (Py_UCS4) -1) goto onError;
temp = _PyUnicode_FromUCS4(&ch, 1);[](#l1.16)
temp = PyUnicode_FromOrdinal(ch);[](#l1.17) break;[](#l1.18) }[](#l1.19)