[Python-checkins] Minor C API documentation improvements. (GH-17696)

Benjamin Peterson webhook-mailer at python.org
Tue Dec 24 23:26:00 EST 2019


https://github.com/python/cpython/commit/5c7ed7550ec2da16d7679e538fcd7c1a5631811f
commit: 5c7ed7550ec2da16d7679e538fcd7c1a5631811f
branch: master
author: William Ayd <william.ayd at icloud.com>
committer: Benjamin Peterson <benjamin at python.org>
date: 2019年12月24日T22:25:56-06:00
summary:
Minor C API documentation improvements. (GH-17696)
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
files:
M Doc/c-api/iter.rst
M Doc/includes/custom.c
diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst
index 0224d37f1a41a..a2992b3452f91 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 bda32e2ad81d4..f361baf830dd1 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;
 }
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /