]> granicus.if.org Git - python/commitdiff
Backport 58332: Fix Coverity #159.
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 5 Oct 2007 05:05:24 +0000 (05:05 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 5 Oct 2007 05:05:24 +0000 (05:05 +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.

Modules/cPickle.c

index dd9887b525a92ad3543ce83bdb95e0920d177aad..b552a4033ac090e3886deb873f7a4c5a2c445631 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;