Commit 2753a096 authored by Victor Stinner's avatar Victor Stinner

locale.delocalize(): only call localeconv() once

parent bbfcb389
......@@ -303,12 +303,16 @@ def str(val):
def delocalize(string):
"Parses a string as a normalized number according to the locale settings."
conv = localeconv()
#First, get rid of the grouping
ts = localeconv()['thousands_sep']
ts = conv['thousands_sep']
if ts:
string = string.replace(ts, '')
#next, replace the decimal point with a dot
dd = localeconv()['decimal_point']
dd = conv['decimal_point']
if dd:
string = string.replace(dd, '.')
return string
......
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