summaryrefslogtreecommitdiffstats
path: root/Lib/json/tests/test_unicode.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2012-01-13 21:53:25 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2012-01-13 21:53:25 (GMT)
commitdee76e627d1561d519b0eb0b179e226f0e1a343f (patch)
treeb3a4528be82a2413d3399ac9ea279124db0ed7d1 /Lib/json/tests/test_unicode.py
parent44765e58b08b5591d30f194871cb672909159e4d (diff)
downloadcpython-dee76e627d1561d519b0eb0b179e226f0e1a343f.zip
cpython-dee76e627d1561d519b0eb0b179e226f0e1a343f.tar.gz
cpython-dee76e627d1561d519b0eb0b179e226f0e1a343f.tar.bz2
Issue #13774: json: Fix a SystemError when a bogus encoding is passed to
json.loads().
Diffstat (limited to 'Lib/json/tests/test_unicode.py')
-rw-r--r--Lib/json/tests/test_unicode.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/json/tests/test_unicode.py b/Lib/json/tests/test_unicode.py
index 31cf389..e90f158 100644
--- a/Lib/json/tests/test_unicode.py
+++ b/Lib/json/tests/test_unicode.py
@@ -80,6 +80,10 @@ class TestUnicode(object):
# Issue 10038.
self.assertEqual(type(self.loads('"foo"')), unicode)
+ def test_bad_encoding(self):
+ self.assertRaises(UnicodeEncodeError, self.loads, '"a"', u"rat\xe9")
+ self.assertRaises(TypeError, self.loads, '"a"', 1)
+
class TestPyUnicode(TestUnicode, PyTest): pass
class TestCUnicode(TestUnicode, CTest): pass