Python 3.12+Linuxsysfunction
sys.deactivate_stack_trampoline()
debugging and tracing
Disables the perf profiler trampolines enabled by activate_stack_trampoline() or the -X perf option. Linux only.
Syntax
sys.deactivate_stack_trampoline()
If no trampoline is active the call does nothing and raises nothing, so it is safe in finally without a check. Deactivating does not delete the /tmp/perf-<PID>.map file already written — perf keeps reading names from it. On other systems the attribute does not exist and the call raises AttributeError, so check sys.platform.
Examples
import sys
if sys.platform == 'linux':
sys.deactivate_stack_trampoline()
print(sys.is_stack_trampoline_active()) # → False
See also
Open in the full glossarydocs.python.orgReport an inaccuracy