cpython/Modules/_testcapi
Victor Stinner 10cbd1fe88
gh-130947: Add again PySequence_Fast() to the limited C API (#130948)
Add again PySequence_Fast() to the limited C API.

Add unit tests.
2025-03-13 13:00:57 +01:00
..
clinic gh-111495: Add PyFile tests (#129449) 2025-01-30 18:05:32 +01:00
README.txt gh-104469: Update README.txt for _testcapi (gh-104529) 2023-05-17 12:56:20 +09:00
abstract.c gh-130947: Add again PySequence_Fast() to the limited C API (#130948) 2025-03-13 13:00:57 +01:00
buffer.c gh-114685: Check flags in PyObject_GetBuffer() (GH-114707) 2024-01-31 13:11:35 +02:00
bytes.c gh-121645: Add PyBytes_Join() function (#121646) 2024-08-30 12:57:33 +00: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-69639: Add mixed-mode rules for complex arithmetic (C-like) (GH-124829) 2024-11-26 17:57:39 +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-82062: Fix support of parameter defaults on methods in extension modules (GH-115270) 2024-05-02 17:44:33 +03:00
exceptions.c gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) 2024-12-17 12:12:45 +01:00
file.c gh-111495: Add PyFile tests (#129449) 2025-01-30 18:05:32 +01:00
float.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01: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-129354: Use PyErr_FormatUnraisable() function (#129514) 2025-01-31 14:20:35 +01: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-124153: Implement `PyType_GetBaseByToken()` and `Py_tp_token` slot (GH-124163) 2024-09-18 09:18:19 +02:00
immortal.c gh-127119: Faster check for small ints in long_dealloc (GH-127620) 2025-01-29 15:22:18 +00: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-102471, PEP 757: Add PyLong import and export API (#121339) 2024-12-13 14:24:48 +01:00
mem.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
monitoring.c GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564) 2024-12-19 16:59:51 +00:00
numbers.c gh-111495: Add tests for PyNumber C API (#111996) 2024-08-26 15:59:22 +02:00
object.c gh-93649: Move _testcapi tests to specific files (#129544) 2025-02-01 13:39:16 +01:00
parts.h gh-93649: Add Modules/_testcapi/function.c file (#129521) 2025-01-31 16:02:50 +01:00
pyatomic.c gh-121368: Fix seq lock memory ordering in _PyType_Lookup (#121388) 2024-07-08 14:52:07 -04:00
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-110850: Add PyTime_TimeRaw() function (#118394) 2024-05-01 18:05:01 +00:00
tuple.c gh-111495: Add tests for PyTuple C API (#118757) 2024-08-26 11:57:52 +02:00
type.c gh-93649: Add Modules/_testcapi/type.c file (#129516) 2025-01-31 15:03:54 +01:00
unicode.c gh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849) 2024-06-24 17:40:39 +02:00
util.h gh-111495: Add tests for `PyCodec_*` C API (#123343) 2024-09-29 15:22:39 +00:00
vectorcall.c gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (#121792) 2024-07-16 11:29:33 +03:00
watchers.c gh-129354: Fix grammar in PyErr_FormatUnraisable() (#129475) 2025-01-31 09:45:35 +01: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.