mirror of
https://github.com/python/cpython.git
synced 2025-07-16 15:55:18 +00:00
Issue #13706: Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF)
This commit is contained in:
parent
6858cabb26
commit
90f50d4df9
3 changed files with 31 additions and 15 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue