Merged revisions 76625 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76625 | amaury.forgeotdarc | 2009-12-01 22:51:04 +0100 (mar., 01 déc. 2009) | 3 lines

  #7419: Fix a crash on Windows in locale.setlocale() when the category
  is outside the allowed range.
........
This commit is contained in:
Amaury Forgeot d'Arc 2009-12-01 21:59:18 +00:00
parent c2e1cb7d36
commit 64f3ca4206
3 changed files with 22 additions and 0 deletions

View file

@ -353,6 +353,17 @@ class TestMiscellaneous(unittest.TestCase):
self.assertRaises(TypeError, locale.strcoll, "a", None)
self.assertRaises(TypeError, locale.strcoll, b"a", None)
def test_setlocale_category(self):
locale.setlocale(locale.LC_ALL)
locale.setlocale(locale.LC_TIME)
locale.setlocale(locale.LC_CTYPE)
locale.setlocale(locale.LC_COLLATE)
locale.setlocale(locale.LC_MONETARY)
locale.setlocale(locale.LC_NUMERIC)
# crasher from bug #7419
self.assertRaises(locale.Error, locale.setlocale, 12345)
def test_main():
tests = [