Commit dba2deec authored by Victor Stinner's avatar Victor Stinner

fill_number() ensures that the 'digits' string is ready

parent afbaa20f
...@@ -587,7 +587,10 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec, ...@@ -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. */ /* Only for type 'c' special case, it has no digits. */
if (spec->n_digits != 0) { if (spec->n_digits != 0) {
/* Fill the digits with InsertThousandsGrouping. */ /* 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) { if (PyUnicode_KIND(digits) < kind) {
pdigits = _PyUnicode_AsKind(digits, kind); pdigits = _PyUnicode_AsKind(digits, kind);
if (pdigits == NULL) if (pdigits == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment