[Python-checkins] r55227 - python/trunk/Objects/setobject.c

guido.van.rossum python-checkins at python.org
Thu May 10 19:20:18 CEST 2007


Author: guido.van.rossum
Date: Thu May 10 19:20:15 2007
New Revision: 55227

Modified:
   python/trunk/Objects/setobject.c
Log:
Fix a bug in test_c_api() that caused a negative refcount.


Modified: python/trunk/Objects/setobject.c
==============================================================================
--- python/trunk/Objects/setobject.c	(original)
+++ python/trunk/Objects/setobject.c	Thu May 10 19:20:15 2007
@@ -2205,7 +2205,7 @@
 	Py_ssize_t count;
 	char *s;
 	Py_ssize_t i;
-	PyObject *elem, *dup, *t, *f, *dup2;
+	PyObject *elem=NULL, *dup=NULL, *t, *f, *dup2, *x;
 	PyObject *ob = (PyObject *)so;
 
 	/* Verify preconditions and exercise type/size checks */
@@ -2251,8 +2251,8 @@
 
 	/* Exercise direct iteration */
 	i = 0, count = 0;
-	while (_PySet_Next((PyObject *)dup, &i, &elem)) {
-		s = PyString_AsString(elem);
+	while (_PySet_Next((PyObject *)dup, &i, &x)) {
+		s = PyString_AsString(x);
 		assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c'));
 		count++;
 	}


More information about the Python-checkins mailing list