summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-02-02 16:16:30 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-02-02 16:16:30 (GMT)
commit87482ea055c921ffacd704ed41fa41ef6473ad3a (patch)
treeaab71cdfbc4b0f607b963b624132f22db28910da
parent9b1e03ff4b6ffeeab04e8d2d59d17d12826a5dab (diff)
downloadcpython-87482ea055c921ffacd704ed41fa41ef6473ad3a.zip
cpython-87482ea055c921ffacd704ed41fa41ef6473ad3a.tar.gz
cpython-87482ea055c921ffacd704ed41fa41ef6473ad3a.tar.bz2
dump(): Added asserts that self->proto is sane.
-rw-r--r--Modules/cPickle.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 17ccb45..31a59f2 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -2217,7 +2217,8 @@ dump(Picklerobject *self, PyObject *args)
char bytes[2];
bytes[0] = PROTO;
- bytes[1] = self->proto;
+ assert(self->proto >= 0 && self->proto < 256);
+ bytes[1] = (char)self->proto;
if (self->write_func(self, bytes, 2) < 0)
return -1;
}