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 gh-141510: Test frozendict C API (#145081) 2026-02-21 17:00:23 +01:00
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 gh-144629: Add test for the PyFunction_GetAnnotations() function (#144630) 2026-02-10 14:38:24 +00:00
gc.c [3.15] gh-156395: Report frozen objects on free-threaded GC build (GH-156396) (#156420) 2026-08-29 13:22:54 +03:00
getargs.c
hash.c
heaptype.c gh-145921: Add "_DuringGC" functions for tp_traverse (GH-145925) 2026-04-08 09:15:11 +02:00
immortal.c gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (#145901) 2026-03-31 13:17:49 +00:00
import.c [3.15] gh-151510: Fix __lazy_import__ without frame (GH-151511) (#151610) 2026-06-17 18:40:33 +00:00
list.c
long.c gh-147988: Initialize digits in long_alloc() in debug mode (#147989) 2026-04-02 11:55:34 +00:00
mem.c [3.15] gh-158585: Backport test_capi.test_bytes from main (#159588) 2026-10-16 22:33:06 +00:00
modsupport.c gh-144175: Add PyArg_ParseArray() function (#144283) 2026-03-06 21:57:44 +00:00
module.c gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055) 2026-05-05 09:18:04 +02:00
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 [3.15] gh-151130: Add more tests for PyWeakref_* C API (GH-151131) (GH-151140) 2026-06-09 11:37:56 +00:00
pyatomic.c
README.txt
run.c [3.15] gh-152132: Test Py_CompileString() in test_capi.test_run (GH-153470) (#153472) 2026-07-10 02:07:38 +00:00
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 [3.15] gh-145235: Make dict watcher API thread-safe for free-threaded builds (gh-145233) (#149690) 2026-05-11 14:23:39 -04:00
weakref.c [3.15] gh-151130: Add more tests for PyWeakref_* C API (GH-151131) (GH-151140) 2026-06-09 11:37:56 +00: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.