BUG: Fixed tm.set_locale
context manager, it could error and leak when category LC_ALL was used
#47570
+60
−18