summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-12-24 20:35:20 -0800
committerBenjamin Peterson <benjamin@python.org>2019-12-24 22:35:20 -0600
commit090bc148834aa4c92c683c2c07be572c31dd1b68 (patch)
treed6ec3445cb42050042320ba54ce68040be51e34e
parent59d06b987db34cde8783e265709366d244c9e35b (diff)
downloadcpython-git-090bc148834aa4c92c683c2c07be572c31dd1b68.tar.gz
Minor C API documentation improvements. (GH-17698)
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 (cherry picked from commit 5c7ed7550ec2da16d7679e538fcd7c1a5631811f) Co-authored-by: William Ayd <william.ayd@icloud.com>
-rw-r--r--Doc/c-api/iter.rst2
-rw-r--r--Doc/includes/custom.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst
index 62ca082713..6507da9c7f 100644
--- a/Doc/c-api/iter.rst
+++ b/Doc/c-api/iter.rst
@@ -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 */
diff --git a/Doc/includes/custom.c b/Doc/includes/custom.c
index bda32e2ad8..f361baf830 100644
--- a/Doc/includes/custom.c
+++ b/Doc/includes/custom.c
@@ -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;
}