]> granicus.if.org Git - python/commitdiff
Fix the code for stripping the leading 's' from str8 and bytes literals.
authorGuido van Rossum <guido@python.org>
Tue, 3 Jul 2007 20:30:03 +0000 (20:30 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 3 Jul 2007 20:30:03 +0000 (20:30 +0000)
Modules/cPickle.c

index 8aa6eaa7f8507e0c35f46d7c8a51b97af1f51750..d50c74358ac285bc4d8091bfc09074184a3850b8 100644 (file)
@@ -1086,8 +1086,10 @@ save_string(Picklerobject *self, PyObject *args, int doput)
                repr_str = PyString_AS_STRING((PyStringObject *)repr);
 
                 /* Strip leading 's' due to repr() of str8() returning s'...' */
-                if (repr_str[0] == 's')
+                if (repr_str[0] == 's') {
                        repr_str++;
+                       len--;
+               }
 
                if (self->write_func(self, &string, 1) < 0)
                        goto err;