diff Objects/bytesobject.c @ 42319:ac36f06a612b

Fix test_pickle, by reverting the string opcodes (S, T, U) to returning strings, in Latin-1. Bytes are once more pickled through bytes.__reduce__, but now it returns "latin-1" as the second parameter. Unfortunately this breaks datetime pickling. I'll have to investigate further; reverting Martin's changes doesn't seem to help.
author Guido van Rossum <guido@python.org>
date Thu, 19 Jul 2007 22:19:35 +0000
parents d0719406b2c6
children e70cdce0e8b2
line wrap: on
line diff
--- a/Objects/bytesobject.c	Thu Jul 19 18:21:28 2007 +0000
+++ b/Objects/bytesobject.c	Thu Jul 19 22:19:35 2007 +0000
@@ -2724,13 +2724,11 @@
 static PyObject *
 bytes_reduce(PyBytesObject *self)
 {
-    /* XXX: This currently returns a Py_UNICODE-widened string
-       in the tuple which is completely useless. Pickle stopped
-       using it for that reason. */
-    return Py_BuildValue("(O(s#))",
+    return Py_BuildValue("(O(s#s))",
                          self->ob_type,
                          self->ob_bytes == NULL ? "" : self->ob_bytes,
-                         self->ob_size);
+                         self->ob_size,
+                         "latin-1");
 }
 
 static PySequenceMethods bytes_as_sequence = {