mirror of
https://github.com/python/cpython.git
synced 2026-10-28 10:25:05 +08:00
gh-157361: Implement aiter() in Python instead of C Move both forms of aiter() into the frozen _pybuiltins module and remove the C async_callable_iterator types. The callable form now returns an iterator whose __anext__() is a plain coroutine, so call-graph tools can see through it into the awaited result of the callable.
21 lines
623 B
C
21 lines
623 B
C
#ifndef Py_INTERNAL_ITEROBJECT_H
|
|
#define Py_INTERNAL_ITEROBJECT_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifndef Py_BUILD_CORE
|
|
# error "this header requires Py_BUILD_CORE define"
|
|
#endif
|
|
|
|
// Like PyCallIter_New(), but the iteration also stops when *callable* raises
|
|
// an exception matching *stop_exc* (an exception class or a tuple of exception
|
|
// classes). *sentinel* can be NULL; NULL *stop_exc* means StopIteration.
|
|
extern PyObject *_PyCallIter_NewEx(PyObject *callable, PyObject *sentinel,
|
|
PyObject *stop_exc);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* !Py_INTERNAL_ITEROBJECT_H */
|