cpython: e67b3a9bd2dc (original) (raw)

Mercurial > cpython

changeset 75375:e67b3a9bd2dc

- 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:38:37 +0100
parents 8ec51b2e57c2(current diff)4966907d3661(diff)
children 58eef400866e
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 @@ -201,7 +201,7 @@ class BugsTestCase(unittest.TestCase): pass def test_loads_recursion(self):

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

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

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -371,6 +371,7 @@ Yannick Gingras Michael Goderbauer Christoph Gohlke Tim Golden +Guilherme Gonçalves Tiago Gonçalves Chris Gonnerman David Goodger

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

--- a/Python/marshal.c +++ b/Python/marshal.c @@ -1384,7 +1384,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[] = {