Skip to content

Commit

Permalink
Make sure restoring the current locale cannot give an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasole committed Oct 11, 2023
1 parent e5f34aa commit 71ecacf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PyMca5/tests/SpecfileTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ def tearDown(self):
# this should free the handle
gc.collect()
# restore saved locale
locale.setlocale(locale.LC_ALL, current_locale)
try:
locale.setlocale(locale.LC_ALL, current_locale)
except locale.Error:
# this should not happen
print(f"Error trying to restore locale <{current_locale}>")

if self.specfileClass is not None:
if os.path.exists(self.fname):
Expand Down

0 comments on commit 71ecacf

Please sign in to comment.