summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-10 17:20:15 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-10 17:20:15 (GMT)
commit360496d9c0d3c943089efb1a4fe6c2be062b8601 (patch)
treea80769c3f07c130c9a49978a8541d7e6246a492f /Objects
parent3ebc45d602ce461e64121db98751837892b0c35f (diff)
downloadcpython-360496d9c0d3c943089efb1a4fe6c2be062b8601.zip
cpython-360496d9c0d3c943089efb1a4fe6c2be062b8601.tar.gz
cpython-360496d9c0d3c943089efb1a4fe6c2be062b8601.tar.bz2
Fix a bug in test_c_api() that caused a negative refcount.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/setobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index a896d93..208db75 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -2205,7 +2205,7 @@ test_c_api(PySetObject *so)
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 @@ test_c_api(PySetObject *so)
/* 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++;
}