diff Python/marshal.c @ 75374:4966907d3661 3.2

Issue #14177: marshal.loads() now raises TypeError when given an unicode string. Patch by Guilherme Gonçalves.
author Antoine Pitrou <solipsis@pitrou.net>
date Sat, 03 Mar 2012 02:35:32 +0100
parents 185a6ae76479
children e0464fa28c85 e67b3a9bd2dc
line wrap: on
line diff
--- a/Python/marshal.c	Fri Mar 02 18:12:43 2012 +0100
+++ b/Python/marshal.c	Sat Mar 03 02:35:32 2012 +0100
@@ -1383,7 +1383,7 @@
     char *s;
     Py_ssize_t n;
     PyObject* result;
-    if (!PyArg_ParseTuple(args, "s*:loads", &p))
+    if (!PyArg_ParseTuple(args, "y*:loads", &p))
         return NULL;
     s = p.buf;
     n = p.len;
@@ -1400,10 +1400,10 @@
 }
 
 PyDoc_STRVAR(loads_doc,
-"loads(string)\n\
+"loads(bytes)\n\
 \n\
-Convert the string to a value. If no valid value is found, raise\n\
-EOFError, ValueError or TypeError. Extra characters in the string are\n\
+Convert the bytes object to a value. If no valid value is found, raise\n\
+EOFError, ValueError or TypeError. Extra characters in the input are\n\
 ignored.");
 
 static PyMethodDef marshal_methods[] = {