cpython: 4966907d3661 (original) (raw)

Mercurial > cpython

changeset 75374:4966907d3661 3.2

Issue #14177: marshal.loads() now raises TypeError when given an unicode string. Patch by Guilherme Gonçalves. [#14177]

Antoine Pitrou solipsis@pitrou.net
date Sat, 03 Mar 2012 02:35:32 +0100
parents 185a6ae76479
children e67b3a9bd2dc 5a2bc0d574f6
files Lib/test/test_exceptions.py Lib/test/test_marshal.py Misc/ACKS Misc/NEWS Python/marshal.c
diffstat 5 files changed, 15 insertions(+), 6 deletions(-)[+] [-] Lib/test/test_exceptions.py 2 Lib/test/test_marshal.py 7 Misc/ACKS 1 Misc/NEWS 3 Python/marshal.c 8

line wrap: on

line diff

--- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -38,7 +38,7 @@ class ExceptionTests(unittest.TestCase): try: try: import marshal

--- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -184,7 +184,7 @@ class BugsTestCase(unittest.TestCase): pass def test_loads_recursion(self):

def test_recursion_limit(self): @@ -257,6 +257,11 @@ class BugsTestCase(unittest.TestCase): finally: support.unlink(support.TESTFN)

+ def test_main(): support.run_unittest(IntTestCase,

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -341,6 +341,7 @@ Johannes Gijsbers Michael Gilfix Christoph Gohlke Tim Golden +Guilherme Gonçalves Chris Gonnerman David Goodger Hans de Graaff

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -130,6 +130,9 @@ Core and Builtins Library ------- +- Issue #14177: marshal.loads() now raises TypeError when given an unicode

--- a/Python/marshal.c +++ b/Python/marshal.c @@ -1383,7 +1383,7 @@ marshal_loads(PyObject *self, PyObject * char s; Py_ssize_t n; PyObject result;

PyDoc_STRVAR(loads_doc, -"loads(string)\n[](#l5.16) +"loads(bytes)\n[](#l5.17) \n[](#l5.18) -Convert the string to a value. If no valid value is found, raise\n[](#l5.19) -EOFError, ValueError or TypeError. Extra characters in the string are\n[](#l5.20) +Convert the bytes object to a value. If no valid value is found, raise\n[](#l5.21) +EOFError, ValueError or TypeError. Extra characters in the input are\n[](#l5.22) ignored."); static PyMethodDef marshal_methods[] = {