[Python-checkins] r58332 - python/trunk/Modules/cPickle.c

neal.norwitz python-checkins at python.org
Fri Oct 5 07:01:38 CEST 2007


Author: neal.norwitz
Date: Fri Oct  5 07:01:38 2007
New Revision: 58332

Modified:
   python/trunk/Modules/cPickle.c
Log:
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.

Will backport (assuming it's necessary)


Modified: python/trunk/Modules/cPickle.c
==============================================================================
--- python/trunk/Modules/cPickle.c	(original)
+++ python/trunk/Modules/cPickle.c	Fri Oct  5 07:01:38 2007
@@ -2249,7 +2249,7 @@
 			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;


More information about the Python-checkins mailing list