Mercurial > cpython-lru_cache-weakref
diff Python/formatter_unicode.c @ 72496:ad337be523bf
fill_number() ensures that the 'digits' string is ready
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Wed, 28 Sep 2011 21:50:42 +0200 |
| parents | cf3557b65ae1 |
| children | f05c2df39ea8 |
line wrap: on
line diff
--- a/Python/formatter_unicode.c Wed Sep 28 21:50:16 2011 +0200 +++ b/Python/formatter_unicode.c Wed Sep 28 21:50:42 2011 +0200 @@ -587,7 +587,10 @@ /* Only for type 'c' special case, it has no digits. */ if (spec->n_digits != 0) { /* Fill the digits with InsertThousandsGrouping. */ - char *pdigits = PyUnicode_DATA(digits); + char *pdigits; + if (PyUnicode_READY(digits)) + return -1; + pdigits = PyUnicode_DATA(digits); if (PyUnicode_KIND(digits) < kind) { pdigits = _PyUnicode_AsKind(digits, kind); if (pdigits == NULL)
