]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Minor C API documentation improvements. (GH-17696)
authorWilliam Ayd <william.ayd@icloud.com>
Wed, 25 Dec 2019 04:25:56 +0000 (23:25 -0500)
committerBenjamin Peterson <benjamin@python.org>
Wed, 25 Dec 2019 04:25:56 +0000 (22:25 -0600)
The added parentheses around the PyIter_Next assignment suppress the following warning which gcc throws without:
```
warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
```
The other change is a typo fix

Doc/c-api/iter.rst
Doc/includes/custom.c

index 0224d37f1a41a00bd550c6d1a44344a8e417c081..a2992b3452f91c3c1fb9d3fc9a5ebd4a75e3be3d 100644 (file)
@@ -29,7 +29,7 @@ something like this::
        /* propagate error */
    }
 
-   while (item = PyIter_Next(iterator)) {
+   while ((item = PyIter_Next(iterator))) {
        /* do something with item */
        ...
        /* release reference when done */
index bda32e2ad81d464c54aac5a442346ce95691e03e..f361baf830dd1b3c9a0b644479683b4f884affd5 100644 (file)
@@ -37,7 +37,7 @@ PyInit_custom(void)
     Py_INCREF(&CustomType);
     if (PyModule_AddObject(m, "Custom", (PyObject *) &CustomType) < 0) {
         Py_DECREF(&CustomType);
-        PY_DECREF(m);
+        Py_DECREF(m);
         return NULL;
     }