0
0
mirror of https://github.com/python/cpython.git synced 2024-11-25 09:39:56 +01:00
cpython/Modules/_testcapi
Erlend E. Aasland e006c7371d
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>
2024-08-08 00:47:15 +02:00
..
clinic
abstract.c gh-105201: Add PyIter_NextItem() (#122331) 2024-08-08 00:47:15 +02:00
buffer.c
bytes.c
code.c
codec.c
complex.c
datetime.c
dict.c
docstring.c
exceptions.c gh-121040: Use __attribute__((fallthrough)) (#121044) 2024-06-27 09:58:44 +00:00
file.c
float.c
gc.c Replace PyObject_Del with PyObject_Free (#122453) 2024-08-01 14:12:33 +02:00
getargs.c
hash.c
heaptype.c Update PyObject_Del() documentation (#122597) 2024-08-02 12:13:33 +02:00
immortal.c
list.c
long.c
mem.c
monitoring.c
numbers.c
object.c gh-118789: Add PyUnstable_Object_ClearWeakRefsNoCallbacks (#118807) 2024-06-18 09:57:23 -04:00
parts.h
pyatomic.c gh-121368: Fix seq lock memory ordering in _PyType_Lookup (#121388) 2024-07-08 14:52:07 -04:00
README.txt
run.c
set.c
structmember.c
time.c
tuple.c gh-111495: add stub files for C API test modules (GH-111586) 2023-11-01 07:44:54 +02:00
unicode.c gh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849) 2024-06-24 17:40:39 +02:00
util.h
vectorcall.c gh-121791: Check for NULL in MethodDescriptor2_new in _testcapi (#121792) 2024-07-16 11:29:33 +03:00
watchers.c

Tests in this directory are compiled into the _testcapi extension.
The main file for the extension is Modules/_testcapimodule.c, which
calls `_PyTestCapi_Init_*` from these functions.

General guideline when writing test code for C API.
* Use Argument Clinic to minimise the amount of boilerplate code.
* Add a newline between the argument spec and the docstring.
* If a test description is needed, make sure the added docstring clearly and succinctly describes purpose of the function.
* DRY, use the clone feature of Argument Clinic.
* Try to avoid adding new interned strings; reuse existing parameter names if possible. Use the `as` feature of Argument Clinic to override the C variable name, if needed.