Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dba2dee

Browse files
author
Victor Stinner
committed
fill_number() ensures that the 'digits' string is ready
1 parent afbaa20 commit dba2dee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Python/formatter_unicode.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,10 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
587587
/* Only for type 'c' special case, it has no digits. */
588588
if (spec->n_digits != 0) {
589589
/* Fill the digits with InsertThousandsGrouping. */
590-
char *pdigits = PyUnicode_DATA(digits);
590+
char *pdigits;
591+
if (PyUnicode_READY(digits))
592+
return -1;
593+
pdigits = PyUnicode_DATA(digits);
591594
if (PyUnicode_KIND(digits) < kind) {
592595
pdigits = _PyUnicode_AsKind(digits, kind);
593596
if (pdigits == NULL)

0 commit comments

Comments
 (0)