From: Neal Norwitz <nnorwitz@gmail.com>
Date: Fri, 5 Oct 2007 05:05:24 +0000 (+0000)
Subject: Backport 58332: Fix Coverity #159.
X-Git-Tag: v2.5.2c1~170
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9f22b954fd8b35eae4adef0652d27473edfdd44;p=python

Backport 58332: Fix Coverity #159.

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.
---

diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index dd9887b525..b552a4033a 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -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;