cpython/Modules/_testcapi
Petr Viktorin b22ff1e543
gh-140550: allow slots that repeat information from PyModuleDef (GH-144340)
When integrating slots-based module creation is with the inittab,
which currently requires PyModuleDef, it would be convenient to
reuse the the same slots array for the MethodDef.

Allow slots that match what's already present in the PyModuleDef.
2026-02-09 11:35:43 +01:00
..
clinic gh-130317: Fix test_pack_unpack_roundtrip() and add docs (#133204) 2025-05-01 16:20:36 +02:00
abstract.c gh-135075: Make PyObject_SetAttr() fail with NULL value and exception (#136180) 2025-07-03 14:51:44 +02:00
buffer.c gh-140557: Force alignment of empty bytearray and array.array buffers (GH-140559) 2026-01-26 16:45:17 +01:00
bytes.c gh-129813: Fix PyBytesWriter tests (#139892) 2025-10-10 13:01:06 +02:00
code.c gh-128911: Use PyImport_ImportModuleAttr() function (#129657) 2025-02-05 11:03:58 +01:00
codec.c gh-111495: Add tests for PyCodec_* C API (#123343) 2024-09-29 15:22:39 +00:00
complex.c gh-128813: hide mixed-mode functions for complex arithmetic from C-API (#131703) 2025-04-22 14:18:18 +02:00
config.c gh-107954, PEP 741: Add PyConfig_Get()/Set() functions (#123472) 2024-09-02 23:25:08 +02:00
datetime.c gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194) 2024-10-09 17:15:23 +02:00
dict.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
docstring.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
exceptions.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
file.c gh-132162: Add tests for Py_UniversalNewlineFgets() (#132164) 2025-04-24 17:43:48 +02:00
float.c gh-143429: Use compile-time NaN encoding detection for test_struct (#143432) 2026-01-09 10:46:48 +00:00
frame.c gh-93649: Move PyFrame C API tests to test_capi (#129512) 2025-01-31 13:51:58 +01:00
function.c gh-93649: Add Modules/_testcapi/function.c file (#129521) 2025-01-31 16:02:50 +01:00
gc.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02: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-122854: Add Py_HashBuffer() function (#122855) 2024-08-30 15:42:27 +00:00
heaptype.c gh-140550: Initial implementation of PEP 793 – PyModExport (GH-140556) 2025-11-05 12:31:42 +01:00
immortal.c gh-133059: Increase the small positive integer cache to 1024 (GH-133160) 2025-09-24 17:05:30 -04:00
import.c gh-128911: Add PyImport_ImportModuleAttr() function (#128912) 2025-01-30 11:17:29 +00:00
list.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
long.c gh-135709: Fix two compile warnings on WASM buildbot (#135712) 2025-06-19 18:46:40 +03:00
mem.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
modsupport.c gh-137210: Add a struct, slot & function for checking an extension's ABI (GH-137212) 2025-09-05 16:23:18 +02:00
module.c gh-140550: allow slots that repeat information from PyModuleDef (GH-144340) 2026-02-09 11:35:43 +01:00
monitoring.c gh-79315: Remove Include/pylock.h and Include/monitoring.h (#139731) 2025-10-08 00:49:24 +02:00
numbers.c gh-111495: Add tests for PyNumber C API (#111996) 2024-08-26 15:59:22 +02:00
object.c gh-141070: Rename PyUnstable_Object_Dump to PyObject_Dump (GH-142848) 2026-01-16 09:19:43 -05:00
parts.h gh-140550: Initial implementation of PEP 793 – PyModExport (GH-140556) 2025-11-05 12:31:42 +01:00
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 Fix typos in docs, error messages and comments (#123336) 2024-08-28 14:41:04 +03:00
set.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
structmember.c gh-127572: Fix test_structmembers initialization (GH-127577) 2024-12-04 09:58:22 +01:00
time.c gh-136300: Modify C tests to conform to PEP-737 (GH-136301) 2025-07-11 15:18:35 +02:00
tuple.c gh-111489: Add PyTuple_FromArray() function (#139691) 2025-10-10 08:54:12 +02:00
type.c gh-93649: Add Modules/_testcapi/type.c file (#129516) 2025-01-31 15:03:54 +01:00
unicode.c gh-134891: Add PyUnstable_Unicode_GET_CACHED_HASH (GH-134892) 2025-06-06 15:51:00 +02:00
util.h gh-111495: Add tests for PyCodec_* C API (#123343) 2024-09-29 15:22:39 +00:00
vectorcall.c GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
watchers.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00

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.