diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-28 21:50:42 +0200 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-28 21:50:42 +0200 |
| commit | 895a5d4f7037dfc0563aa482d07b5d32b5dca481 (patch) | |
| tree | e1eea09f0866cd435bb8b84cce93b67c1d668f66 /Python/formatter_unicode.c | |
| parent | 0511538a040f2b8c33fdafcfeabf4ad8bf8ff754 (diff) | |
| download | cpython-895a5d4f7037dfc0563aa482d07b5d32b5dca481.tar.gz | |
fill_number() ensures that the 'digits' string is ready
Diffstat (limited to 'Python/formatter_unicode.c')
| -rw-r--r-- | Python/formatter_unicode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c index 86385f6f7f..52ccafa8d0 100644 --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -587,7 +587,10 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec, /* 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) |
