[Python-checkins] cpython: fill_number() ensures that the 'digits' string is ready

victor.stinner python-checkins at python.org
Wed Sep 28 22:08:39 CEST 2011


http://hg.python.org/cpython/rev/ad337be523bf
changeset:   72496:ad337be523bf
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Wed Sep 28 21:50:42 2011 +0200
summary:
  fill_number() ensures that the 'digits' string is ready

files:
  Python/formatter_unicode.c |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
--- a/Python/formatter_unicode.c
+++ b/Python/formatter_unicode.c
@@ -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)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list