bpo-46659: Enhance LocaleTextCalendar for C locale by vstinner · Pull Request #31214 · python/cpython
The previous code based on getdefaultlocale() was a one time check of LC_ALL, LC_CTYPE, and LANG. This was technically wrong, but in practice the default LC_TIME is usually the same as the default LC_CTYPE.
I think it's correct to use the current LC_TIME locale, if it was configured already. Not doing so was a bug. However, it should try to remain close to the previous default behavior when instantiating LocaleTextCalendar() when LC_TIME is the initial "C" value, which is usually the case if a script doesn't explicitly set LC_ALL or LC_TIME.
But changing it to re-evaluate the default via setlocale(LC_TIME, "") for every formatweekday() call is going too far. That depends on the current values of the environment variables LC_ALL, LC_TIME, and LANG, which is very different from the one-time getdefaultlocale() call in the previous code.