]> granicus.if.org Git - python/commitdiff
Fix Coverity #159.
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 5 Oct 2007 05:01:38 +0000 (05:01 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 5 Oct 2007 05:01:38 +0000 (05:01 +0000)
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.

Will backport (assuming it's necessary)

Modules/cPickle.c

index fbf6a12baf6e84449f98fca4a912d7c928d5e49c..227f02c87a2a40c50199b7d1f2bc7461c908282f 100644 (file)
@@ -2249,7 +2249,7 @@ save_reduce(Picklerobject *self, PyObject *args, PyObject *ob)
                        Py_INCREF(temp);
                        PyTuple_SET_ITEM(newargtup, i-1, temp);
                }
-               i = save(self, newargtup, 0) < 0;
+               i = save(self, newargtup, 0);
                Py_DECREF(newargtup);
                if (i < 0)
                        return -1;