]> granicus.if.org Git - python/commitdiff
Minor cleanup.
authorRaymond Hettinger <python@rcn.com>
Fri, 14 Aug 2015 09:07:41 +0000 (02:07 -0700)
committerRaymond Hettinger <python@rcn.com>
Fri, 14 Aug 2015 09:07:41 +0000 (02:07 -0700)
Modules/_collectionsmodule.c

index 749cf6b31de108dc038c779bfca804e8ff15c034..35034a50aa4ad4c126e7b8136a8616c07b1c9ec3 100644 (file)
@@ -2167,13 +2167,13 @@ _count_elements(PyObject *self, PyObject *args)
 
             oldval = _PyDict_GetItem_KnownHash(mapping, key, hash);
             if (oldval == NULL) {
-                if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) == -1)
+                if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) < 0)
                     goto done;
             } else {
                 newval = PyNumber_Add(oldval, one);
                 if (newval == NULL)
                     goto done;
-                if (_PyDict_SetItem_KnownHash(mapping, key, newval, hash) == -1)
+                if (_PyDict_SetItem_KnownHash(mapping, key, newval, hash) < 0)
                     goto done;
                 Py_CLEAR(newval);
             }
@@ -2199,7 +2199,7 @@ _count_elements(PyObject *self, PyObject *args)
             Py_DECREF(oldval);
             if (newval == NULL)
                 break;
-            if (PyObject_SetItem(mapping, key, newval) == -1)
+            if (PyObject_SetItem(mapping, key, newval) < 0)
                 break;
             Py_CLEAR(newval);
             Py_DECREF(key);