cpython/Modules/_testinternalcapi
Pablo Galindo Salgado 9a268e3e33
gh-98894: Restore function entry/exit DTrace probes (#142397)
The function__entry and function__return probes stopped working in Python 3.11
when the interpreter was restructured around the new bytecode system. This change
restores these probes by adding DTRACE_FUNCTION_ENTRY() at the start_frame label
in bytecodes.c and DTRACE_FUNCTION_RETURN() in the RETURN_VALUE and YIELD_VALUE
instructions. The helper functions are defined in ceval.c and extract the
filename, function name, and line number from the frame before firing the probe.

This builds on the approach from https://github.com/python/cpython/pull/125019
but avoids modifying the JIT template since the JIT does not currently support
DTrace. The macros are conditionally compiled with WITH_DTRACE and are no-ops
otherwise. The tests have been updated to use modern opcode names (CALL, CALL_KW,
CALL_FUNCTION_EX) and a new bpftrace backend was added for Linux CI alongside
the existing SystemTap tests. Line probe tests were removed since that probe
was never restored after 3.11.
2026-05-05 00:29:55 +00:00
..
clinic gh-145230: Update lockbench (gh-145231) 2026-02-27 14:09:05 -05:00
complex.c gh-128813: hide mixed-mode functions for complex arithmetic from C-API (#131703) 2025-04-22 14:18:18 +02:00
interpreter.c gh-146031: Allow keeping specialization enabled when specifying eval frame function (#146032) 2026-04-16 09:44:26 -07:00
parts.h GH-145247: Implement _PyTuple_FromPair() (#145325) 2026-03-10 11:44:20 +01:00
pytime.c Remove internal _PyTime_AsLong() function (#141053) 2025-11-05 18:37:06 +01:00
README.txt
set.c gh-112069: Add _PySet_NextEntryRef to be thread-safe. (gh-117990) 2024-04-19 00:18:22 +09:00
test_cases.c.h gh-98894: Restore function entry/exit DTrace probes (#142397) 2026-05-05 00:29:55 +00:00
test_critical_sections.c gh-144513: Skip critical section locking during stop-the-world (gh-144524) 2026-02-06 15:14:08 +00:00
test_lock.c gh-145230: Update lockbench (gh-145231) 2026-02-27 14:09:05 -05:00
test_targets.h gh-98894: Restore function entry/exit DTrace probes (#142397) 2026-05-05 00:29:55 +00:00
testbytecodes.c gh-142913: Add test case for interpreter generator w/ overridden opcodes (#142911) 2026-01-16 10:33:29 -08:00
tuple.c GH-145247: Implement _PyTuple_FromPair() (#145325) 2026-03-10 11:44:20 +01:00

Tests in this directory are compiled into the _testinternalcapi extension.
The main file for the extension is Modules/_testinternalcapimodule.c, which
calls `_PyTestInternalCapi_Init_*` from these functions.

See Modules/_testcapi/README.txt for guideline when writing C test code.