Message350470
Ok; so basically this doesn't work:
<code>
import locale
locale.setlocale(locale.LC_CTYPE, locale.getdefaultlocale())
</code>
It gives "locale.Error: unsupported locale setting" which comes from https://github.com/python/cpython/blob/master/Modules/_localemodule.c#L107
(For locale.getdefaultlocale() you could substitute locale.getlocale() or simply ("en_GB", "cp1252")). On my machine it raises that exception on Python 2.7.15, 3.6.6 and on master.
Interestingly, none of the other tests in test_locale appear to exercise the 2-tuple 2nd param to setlocale. When you call setlocale and it returns the previous setting, it's a single string, eg "en_GB" etc. Passing that back in works. But when you call getlocale, it returns the 2-tuple, eg ("en_GB", "cp1252"). But all the other tests use the setlocale-returns-current trick for their setup/teardown.
I've quickly tested on 3.5 on Linux and the 2-tuple version works ok. I assume it's working on buildbots or we'd see the Turkish test failing every time. So is there something different about my C runtime, I wonder? |
|
Date |
User |
Action |
Args |
2019-08-25 19:29:13 | tim.golden | set | recipients:
+ tim.golden, paul.moore, zach.ware, eryksun, steve.dower, xtreak |
2019-08-25 19:29:13 | tim.golden | set | messageid: <1566761353.12.0.105494276883.issue37945@roundup.psfhosted.org> |
2019-08-25 19:29:13 | tim.golden | link | issue37945 messages |
2019-08-25 19:29:12 | tim.golden | create | |
|