cpython/Modules/_testcapi
Victor Stinner db85e76dc2
[3.15] gh-158585: Backport test_capi.test_bytes from main (#159588)
gh-158585: Backport test_capi.test_bytes from main

Backport also _testcapi.call_with_nomemory().
2026-10-16 22:33:06 +00:00
..
clinic [3.15] gh-156204: Guard recursion in PyErr_GivenExceptionMatches (GH-156205) (GH-158622) 2026-10-11 07:20:28 +00:00
abstract.c
buffer.c
bytes.c [3.15] gh-158585: Fix _PyBytes_Resize() if hash value is already computed (#159555) 2026-10-16 16:55:09 +00:00
code.c
codec.c
complex.c
config.c
datetime.c
dict.c
docstring.c
exceptions.c [3.15] gh-156204: Guard recursion in PyErr_GivenExceptionMatches (GH-156205) (GH-158622) 2026-10-11 07:20:28 +00:00
file.c
float.c
frame.c
function.c
gc.c
getargs.c
hash.c
heaptype.c
immortal.c
import.c
list.c
long.c
mem.c [3.15] gh-158585: Backport test_capi.test_bytes from main (#159588) 2026-10-16 22:33:06 +00:00
modsupport.c
module.c
monitoring.c
numbers.c
object.c [3.15] gh-155905: Fix error handling in _testcapi helpers (GH-155906) (GH-156580) 2026-10-10 12:33:39 +03:00
parts.h
pyatomic.c
README.txt
run.c
set.c
structmember.c
time.c
tuple.c
type.c [3.15] gh-155503: Add more PyType C API tests (#155505) (#159085) 2026-10-09 20:33:40 +00:00
unicode.c [3.15] gh-158451: Add _PyUnicodeWriter_WriteLatin1String() test (#158464) (#159551) 2026-10-16 20:28:34 +02:00
util.h [3.15] gh-156939: Add tests on the PyUnicode C API (#159533) 2026-10-16 16:39:58 +02:00
vectorcall.c
watchers.c
weakref.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.