diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-03-03 01:38:37 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-03-03 01:38:37 (GMT) |
commit | 0d3a003f241460e417f2108fecf990b7ce5d1449 (patch) | |
tree | 8f773e6a59bd4a5244f1025b870d294ccd4eb17e /Lib/test/test_marshal.py | |
parent | 135b6d8aa5a24b08170fd94114a80dfeb1ae963c (diff) | |
parent | 4a90ef03637fdc1bc63ee9be82fbf22cbaa68662 (diff) | |
download | cpython-0d3a003f241460e417f2108fecf990b7ce5d1449.zip cpython-0d3a003f241460e417f2108fecf990b7ce5d1449.tar.gz cpython-0d3a003f241460e417f2108fecf990b7ce5d1449.tar.bz2 |
- Issue #14177: marshal.loads() now raises TypeError when given an unicode
string. Patch by Guilherme Gonçalves.
Diffstat (limited to 'Lib/test/test_marshal.py')
-rw-r--r-- | Lib/test/test_marshal.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py index bd81a1a..83c348c 100644 --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -201,7 +201,7 @@ class BugsTestCase(unittest.TestCase): pass def test_loads_recursion(self): - s = 'c' + ('X' * 4*4) + '{' * 2**20 + s = b'c' + (b'X' * 4*4) + b'{' * 2**20 self.assertRaises(ValueError, marshal.loads, s) def test_recursion_limit(self): @@ -274,6 +274,11 @@ class BugsTestCase(unittest.TestCase): finally: support.unlink(support.TESTFN) + def test_loads_reject_unicode_strings(self): + # Issue #14177: marshal.loads() should not accept unicode strings + unicode_string = 'T' + self.assertRaises(TypeError, marshal.loads, unicode_string) + def test_main(): support.run_unittest(IntTestCase, |