]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-105201: Add PyIter_NextItem() (#122331)
authorErlend E. Aasland <erlend@python.org>
Wed, 7 Aug 2024 22:47:15 +0000 (00:47 +0200)
committerGitHub <noreply@github.com>
Wed, 7 Aug 2024 22:47:15 +0000 (00:47 +0200)
commite006c7371d8e57db26254792c67292956e88d81d
tree7f3b7a2ced182afab89cb4c059445b8581762b6f
parent540fcc62f5da982b79504221cac01bfab8b73ba1
gh-105201: Add PyIter_NextItem() (#122331)

Return -1 and set an exception on error; return 0 if the iterator is
exhausted, and return 1 if the next item was fetched successfully.

Prefer this API to PyIter_Next(), which requires the caller to use
PyErr_Occurred() to differentiate between iterator exhaustion and errors.

Co-authered-by: Irit Katriel <iritkatriel@yahoo.com>
12 files changed:
Doc/c-api/iter.rst
Doc/data/refcounts.dat
Doc/data/stable_abi.dat
Doc/whatsnew/3.14.rst
Include/abstract.h
Lib/test/test_capi/test_abstract.py
Lib/test/test_stable_abi_ctypes.py
Misc/NEWS.d/next/C_API/2024-07-27-00-28-35.gh-issue-105201.0-xUWq.rst [new file with mode: 0644]
Misc/stable_abi.toml
Modules/_testcapi/abstract.c
Objects/abstract.c
PC/python3dll.c