summaryrefslogtreecommitdiffstats
path: root/Modules/cPickle.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-03 20:30:03 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-03 20:30:03 (GMT)
commit1718fd1dc592de4f59206b1c69eb7ed45d92d818 (patch)
tree53aca1422b92de15ef063432caefe19985eee650 /Modules/cPickle.c
parent07d4e78b0f5ffcc5fdfebbf20b1e87a07064fed6 (diff)
downloadcpython-1718fd1dc592de4f59206b1c69eb7ed45d92d818.zip
cpython-1718fd1dc592de4f59206b1c69eb7ed45d92d818.tar.gz
cpython-1718fd1dc592de4f59206b1c69eb7ed45d92d818.tar.bz2
Fix the code for stripping the leading 's' from str8 and bytes literals.
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r--Modules/cPickle.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 8aa6eaa..d50c743 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -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;