cpython/Modules/_testcapi
Petr Viktorin 8fe011af38
[3.12] gh-130824: Add tests for NULL in PyLong_*AndOverflow functions (GH-130828) (GH-130876)
(cherry picked from commit 90130807d9)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-03-05 13:52:40 +02:00
..
clinic [3.12] gh-111495: Add PyFile tests (#129449) (#129477) (#129501) 2025-01-31 10:27:35 +01:00
abstract.c [3.12] Add more C API tests (GH-112522) (GH-112525) 2023-11-29 22:02:57 +02:00
buffer.c gh-102500: Implement PEP 688 (#102521) 2023-05-04 07:59:46 -07:00
bytearray.c [3.12] gh-111495: Add tests for PyBytes and PyByteArray C API (GH-111496) (GH-111607) 2023-11-01 18:23:39 +00:00
bytes.c
code.c [3.12] C API tests: use special markers to test that output parameters were set (GH-109014) (#109023) 2023-09-08 15:09:49 +02:00
codec.c
complex.c
datetime.c
dict.c [3.12] gh-110549: Remove unused includes of <stddef.h> in _testcapi (GH-110552) (GH-110553) 2023-10-09 11:43:35 +00:00
docstring.c gh-93649: Split memory and docstring tests from _testcapimodule.c (#99517) 2022-11-16 14:09:10 +01:00
eval.c [3.12] gh-111495: Add more tests on PyEval C APIs (#122789) (#128987) (#129023) 2025-01-19 13:51:53 +00:00
exceptions.c [3.12] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) (GH-128027) 2024-12-17 14:53:16 +02:00
file.c [3.12] gh-111495: Add PyFile tests (#129449) (#129477) (#129501) 2025-01-31 10:27:35 +01:00
float.c [3.12] gh-111495: Add tests for PyFloat C API (GH-111624) (GH-111752) 2023-11-05 10:01:31 +02:00
gc.c
getargs.c [3.12] gh-112438: Fix support of format units with the "e" prefix in nested tuples in PyArg_Parse (gh-112439) (GH-112460) 2023-11-27 17:57:30 +00:00
heaptype.c [3.12] gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386) (GH-105697) 2023-06-12 16:24:21 +00:00
heaptype_relative.c gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511) 2023-05-04 09:56:53 +02:00
immortal.c Trim trailing whitespace and test on CI (#104275) 2023-05-08 17:03:52 +03:00
import.c [3.12] gh-128911: Add tests on the PyImport C API (GH-128915) (GH-128960) (#128989) 2025-01-19 14:21:55 +01:00
list.c [3.12] gh-111495: Add tests for PyList C API (GH-111562) (GH-111861) 2023-11-08 18:10:13 +00:00
long.c [3.12] gh-130824: Add tests for NULL in PyLong_*AndOverflow functions (GH-130828) (GH-130876) 2025-03-05 13:52:40 +02:00
mem.c [3.12] gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) (#129217) (#129221) 2025-01-23 13:29:46 +00:00
numbers.c [3.12] gh-111495: Add tests for PyNumber C API (GH-111996) (#123376) 2024-09-06 00:51:26 +02:00
parts.h [3.12] gh-111495: Add more tests on PyEval C APIs (#122789) (#128987) (#129023) 2025-01-19 13:51:53 +00:00
pyos.c GH-94808: Cover PyOS_mystrnicmp and PyOS_mystricmp (gh-102469) 2023-03-22 20:35:27 +09:00
pytime.c gh-93649: Split pytime and datetime tests from _testcapimodule.c (#99494) 2022-11-15 08:17:52 +01:00
README.txt gh-104469: Update README.txt for _testcapi (gh-104529) 2023-05-17 12:56:20 +09:00
run.c [3.12] gh-117968: Make the test for closed file more safe in the C API tests (GH-118230) (GH-118266) 2024-04-25 05:16:43 +00:00
set.c
structmember.c [3.12] gh-47146: Fix reference counting in _testcapi.structmember initializer (GH-106862) (GH-106953) 2023-07-21 14:48:50 +03:00
sys.c [3.12] gh-111065: Add more tests for the C API with the PySys_ prefix (GH-111067) (GH-111305) 2023-10-25 09:10:03 +00:00
testcapi_long.h gh-93649: Split float/long tests from _testcapimodule.c (GH-99549) 2022-11-17 00:56:56 -08:00
tuple.c [3.12] gh-111495: Add tests for PyTuple C API (GH-118757) (#123379) 2024-09-06 00:51:02 +02:00
unicode.c [3.12] C API tests: use special markers to test that output parameters were set (GH-109014) (#109023) 2023-09-08 15:09:49 +02:00
util.h
vectorcall.c
vectorcall_limited.c gh-98586: Add vector call APIs to the Limited API (GH-98587) 2022-10-27 11:45:42 +02: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.