]> granicus.if.org Git - python/commitdiff
Fix a bug in test_c_api() that caused a negative refcount.
authorGuido van Rossum <guido@python.org>
Thu, 10 May 2007 17:20:15 +0000 (17:20 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 10 May 2007 17:20:15 +0000 (17:20 +0000)
Objects/setobject.c

index a896d937faec3046179dc5323534953a25768483..208db75b4f715396759007a1caff5c28e465a236 100644 (file)
@@ -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++;
        }