Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: third_party/cython/src/Cython/Includes/cpython/iterator.pxd

Issue 385073004: Adding cython v0.20.2 in third-party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reference cython dev list thread. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 cdef extern from "Python.h":
2
3 ############################################################################
4 # 6.5 Iterator Protocol
5 ############################################################################
6 bint PyIter_Check(object o)
7 # Return true if the object o supports the iterator protocol.
8
9 object PyIter_Next(object o)
10 # Return value: New reference.
11 # Return the next value from the iteration o. If the object is an
12 # iterator, this retrieves the next value from the iteration, and
13 # returns NULL with no exception set if there are no remaining
14 # items. If the object is not an iterator, TypeError is raised, or
15 # if there is an error in retrieving the item, returns NULL and
16 # passes along the exception.
17
18 # To write a loop which iterates over an iterator, the C code should look so mething like this:
19 # PyObject *iterator = PyObject_GetIter(obj);
20 # PyObject *item;
21 # if (iterator == NULL) {
22 # /* propagate error */
23 # }
24 # while (item = PyIter_Next(iterator)) {
25 # /* do something with item */
26 # ...
27 # /* release reference when done */
28 # Py_DECREF(item);
29 # }
30 # Py_DECREF(iterator);
31 # if (PyErr_Occurred()) {
32 # /* propagate error */
33 # }
34 # else {
35 # /* continue doing useful work */
36 # }
OLDNEW
« no previous file with comments | « third_party/cython/src/Cython/Includes/cpython/int.pxd ('k') | third_party/cython/src/Cython/Includes/cpython/list.pxd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698