Skip to content

Commit

Permalink
Use C locale instead of en_US as that may not be installed on all sys…
Browse files Browse the repository at this point in the history
…tems
  • Loading branch information
bouweandela committed Sep 11, 2024
1 parent 48c2985 commit b1a9302
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cf_units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ def suppress_errors():


@contextmanager
def us_locale():
def c_locale():
with LOCALE_LOCK:
lc_numeric = locale.getlocale(locale.LC_NUMERIC)
locale.setlocale(locale.LC_NUMERIC, "en_US.UTF-8")
locale.setlocale(locale.LC_NUMERIC, "C")
try:
yield
finally:
Expand All @@ -195,7 +195,7 @@ def us_locale():
# load the UDUNITS-2 xml-formatted unit-database
#:
# Ignore standard noisy UDUNITS-2 start-up.
with suppress_errors(), us_locale():
with suppress_errors(), c_locale():
# Load the unit-database from the default location (modified via
# the UDUNITS2_XML_PATH environment variable) and if that fails look
# relative to sys.prefix to support environments such as conda.
Expand Down

0 comments on commit b1a9302

Please sign in to comment.