Commit 360496d9 authored by Guido van Rossum's avatar Guido van Rossum

Fix a bug in test_c_api() that caused a negative refcount.

parent 3ebc45d6
...@@ -2205,7 +2205,7 @@ test_c_api(PySetObject *so) ...@@ -2205,7 +2205,7 @@ test_c_api(PySetObject *so)
Py_ssize_t count; Py_ssize_t count;
char *s; char *s;
Py_ssize_t i; Py_ssize_t i;
PyObject *elem, *dup, *t, *f, *dup2; PyObject *elem=NULL, *dup=NULL, *t, *f, *dup2, *x;
PyObject *ob = (PyObject *)so; PyObject *ob = (PyObject *)so;
/* Verify preconditions and exercise type/size checks */ /* Verify preconditions and exercise type/size checks */
...@@ -2251,8 +2251,8 @@ test_c_api(PySetObject *so) ...@@ -2251,8 +2251,8 @@ test_c_api(PySetObject *so)
/* Exercise direct iteration */ /* Exercise direct iteration */
i = 0, count = 0; i = 0, count = 0;
while (_PySet_Next((PyObject *)dup, &i, &elem)) { while (_PySet_Next((PyObject *)dup, &i, &x)) {
s = PyString_AsString(elem); s = PyString_AsString(x);
assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')); assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c'));
count++; count++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment