Marc-Andre Lemburg <m...@egenix.com> added the comment: Python can be embedded into other applications and unconditionally changing the locale (esp. the LC_CTYPE) is not good practice, since it's not thread-safe and affects the entire process. An application may have set LC_CTYPE (or the locale) to something completely different.
If at all, Python should be more careful using this call (pseudo code): lc_ctype = setlocale(LC_CTYPE, NULL); if (lc_ctype == NULL || strcmp(lc_ctype, "") || strcmp(lc_ctype, "C")) { env_lc_ctype = setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, lc_ctype); lc_ctype = env_lc_ctype; } Then use lc_ctype to figure out encodings, etc. While this is not thread-safe, it at least reverts the change back to the original setting and only applies the change if needed. That's still not optimal, but better than nothing. An clean alternative would be adding LC_* variable parsing code to Python to avoid the setlocale() call altogether. ---------- nosy: +lemburg _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6203> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com