summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-12-01 21:51:04 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-12-01 21:51:04 (GMT)
commitd728871ee170604e18dd8e0bf1b28b6520a5b809 (patch)
tree826b4afa90b41c4033813778be9d571827862acf /Lib/test
parent7072f74dc8bea03490ab09af3ee5a902bdc6f284 (diff)
downloadcpython-d728871ee170604e18dd8e0bf1b28b6520a5b809.zip
cpython-d728871ee170604e18dd8e0bf1b28b6520a5b809.tar.gz
cpython-d728871ee170604e18dd8e0bf1b28b6520a5b809.tar.bz2
#7419: Fix a crash on Windows in locale.setlocale() when the category
is outside the allowed range.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_locale.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index d9d3cd9..4510409 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -360,6 +360,17 @@ class TestMiscellaneous(unittest.TestCase):
# test crasher from bug #3303
self.assertRaises(TypeError, locale.strcoll, u"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 = [