cpython/Modules/_testcapi
Victor Stinner 12af8ec864
gh-121040: Use __attribute__((fallthrough)) (#121044)
Fix warnings when using -Wimplicit-fallthrough compiler flag.

Annotate explicitly "fall through" switch cases with a new
_Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if
available. Replace "fall through" comments with _Py_FALLTHROUGH.

Add _Py__has_attribute() macro. No longer define __has_attribute()
macro if it's not defined. Move also _Py__has_builtin() at the top
of pyport.h.

Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
2024-06-27 09:58:44 +00:00
..
clinic gh-116417: Move limited C API long.c tests to _testlimitedcapi (#117001) 2024-03-19 14:04:23 +00:00
README.txt gh-104469: Update README.txt for _testcapi (gh-104529) 2023-05-17 12:56:20 +09:00
abstract.c gh-116417: Move limited C API abstract.c tests to _testlimitedcapi (#116986) 2024-03-19 10:44:13 +00:00
buffer.c gh-114685: Check flags in PyObject_GetBuffer() (GH-114707) 2024-01-31 13:11:35 +02:00
bytes.c gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160) 2024-03-25 16:32:11 +01:00
code.c C API tests: use special markers to test that output parameters were set (GH-109014) 2023-09-06 22:02:01 +03:00
codec.c gh-111495: add stub files for C API test modules (GH-111586) 2023-11-01 07:44:54 +02:00
complex.c gh-116417: Move limited C API complex.c tests to _testlimitedcapi (#117014) 2024-03-19 17:23:12 +01:00
datetime.c gh-117398: Add datetime C-API type check test for subinterpreters (gh-119604) 2024-06-13 12:05:03 -06:00
dict.c gh-112075: use per-thread dict version pool (#118676) 2024-05-07 00:22:26 +00:00
docstring.c gh-82062: Fix support of parameter defaults on methods in extension modules (GH-115270) 2024-05-02 17:44:33 +03:00
exceptions.c gh-121040: Use __attribute__((fallthrough)) (#121044) 2024-06-27 09:58:44 +00:00
file.c gh-111495: add stub files for C API test modules (GH-111586) 2023-11-01 07:44:54 +02:00
float.c gh-116417: Move limited C API abstract.c tests to _testlimitedcapi (#116986) 2024-03-19 10:44:13 +00:00
gc.c gh-118362: Fix thread safety around lookups from the type cache in the face of concurrent mutators (#118454) 2024-05-06 10:50:35 -07:00
getargs.c gh-68114: Fix handling for removed PyArg_ParseTuple 'w' formatters (GH-8204) 2024-04-23 13:15:15 +02:00
hash.c gh-113024: C API: Add PyObject_GenericHash() function (GH-113025) 2024-03-22 20:19:10 +02:00
heaptype.c gh-107073: Make PyObject_VisitManagedDict() public (#108763) 2023-10-02 19:24:08 +02:00
immortal.c Trim trailing whitespace and test on CI (#104275) 2023-05-08 17:03:52 +03:00
list.c gh-116417: Move limited C API list.c tests to _testlimitedcapi (#116602) 2024-03-18 22:03:55 +01:00
long.c gh-116560: Add PyLong_GetSign() public function (#116561) 2024-06-03 14:06:31 +02:00
mem.c gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00
monitoring.c gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (#119216) 2024-05-21 20:42:51 +00:00
numbers.c gh-111495: add stub files for C API test modules (GH-111586) 2023-11-01 07:44:54 +02:00
object.c gh-118789: Add `PyUnstable_Object_ClearWeakRefsNoCallbacks` (#118807) 2024-06-18 09:57:23 -04:00
parts.h gh-111997: C-API for signalling monitoring events (#116413) 2024-05-04 08:23:50 +00:00
pyatomic.c gh-109693: Update _gil_runtime_state.locked to use pyatomic.h (gh-110836) 2023-10-17 07:32:50 +09:00
run.c gh-118422: Fix run_fileexflags() test (#118429) 2024-04-30 22:32:55 +02:00
set.c gh-116417: Move limited C API list.c tests to _testlimitedcapi (#116602) 2024-03-18 22:03:55 +01:00
structmember.c gh-47146: Fix reference counting in _testcapi.structmember initializer (GH-106862) 2023-07-21 12:30:14 +03:00
time.c gh-110850: Add PyTime_TimeRaw() function (#118394) 2024-05-01 18:05:01 +00:00
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 gh-109469: Silence compiler warnings on string comparisons in _testcapi (GH-109533) 2023-09-19 08:12:29 +03:00
vectorcall.c gh-110964: Remove private _PyArg functions (#110966) 2023-10-17 14:30:31 +02:00
watchers.c GH-113710: Add a "globals to constants" pass (GH-114592) 2024-02-02 12:14:34 +00:00

README.txt

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.