diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2012-02-24 00:44:47 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2012-02-24 00:44:47 (GMT) |
commit | 90f50d4df9e21093f006427fd7ed11a0d704f792 (patch) | |
tree | 0651d6bff923a47322b798b554cbac68c34c845d /Objects | |
parent | 6858cabb265ed752aeb27cacbacd58817daaacaa (diff) | |
download | cpython-90f50d4df9e21093f006427fd7ed11a0d704f792.zip cpython-90f50d4df9e21093f006427fd7ed11a0d704f792.tar.gz cpython-90f50d4df9e21093f006427fd7ed11a0d704f792.tar.bz2 |
Issue #13706: Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 2841b07..7753c32 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9176,9 +9176,16 @@ _PyUnicode_InsertThousandsGrouping( thousands_sep_data = PyUnicode_DATA(thousands_sep); thousands_sep_len = PyUnicode_GET_LENGTH(thousands_sep); if (unicode != NULL && thousands_sep_kind != kind) { - thousands_sep_data = _PyUnicode_AsKind(thousands_sep, kind); - if (!thousands_sep_data) - return -1; + if (thousands_sep_kind < kind) { + thousands_sep_data = _PyUnicode_AsKind(thousands_sep, kind); + if (!thousands_sep_data) + return -1; + } + else { + data = _PyUnicode_AsKind(unicode, thousands_sep_kind); + if (!data) + return -1; + } } switch (kind) { @@ -9210,8 +9217,12 @@ _PyUnicode_InsertThousandsGrouping( assert(0); return -1; } - if (unicode != NULL && thousands_sep_kind != kind) - PyMem_Free(thousands_sep_data); + if (unicode != NULL && thousands_sep_kind != kind) { + if (thousands_sep_kind < kind) + PyMem_Free(thousands_sep_data); + else + PyMem_Free(data); + } if (unicode == NULL) { *maxchar = 127; if (len != n_digits) { |