summaryrefslogtreecommitdiffstats
path: root/Python/formatter_unicode.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-09-28 19:50:42 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-09-28 19:50:42 (GMT)
commitdba2deeca2c070e2dfa08649b5729208567fd414 (patch)
tree63437a2ae4cb49ba5a0ec6d9bd800858d6e66623 /Python/formatter_unicode.c
parentafbaa20fb92a1983d94e19715014872c6d9daebe (diff)
downloadcpython-dba2deeca2c070e2dfa08649b5729208567fd414.zip
cpython-dba2deeca2c070e2dfa08649b5729208567fd414.tar.gz
cpython-dba2deeca2c070e2dfa08649b5729208567fd414.tar.bz2
fill_number() ensures that the 'digits' string is ready
Diffstat (limited to 'Python/formatter_unicode.c')
-rw-r--r--Python/formatter_unicode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
index 86385f6..52ccafa 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)