On this page
sys.set_coroutine_origin_tracking_depth
Prev: sys.set_asyncgen_hooks | Up: sys | Next: sys.set_int_max_str_digits
Rel: sys.activate_stack_trampoline, sys.addaudithook, sys.audit, sys.breakpointhook
Ref: docs.python.org — sys.set_coroutine_origin_tracking_depth
Tags: #public #python3 #stdlib #sys
Import
import sys
from sys import set_coroutine_origin_tracking_depth
Signature & Overview
sys.set_coroutine_origin_tracking_depth(depth)
Enable or disable origin tracking for coroutine objects in this thread.
Usage
import sys
old = sys.get_coroutine_origin_tracking_depth()
sys.set_coroutine_origin_tracking_depth(5)
try:
assert sys.get_coroutine_origin_tracking_depth() == 5
finally:
sys.set_coroutine_origin_tracking_depth(old)
Gotchas
- Thread-local debugging setting: Adds slight overhead to every coroutine creation—enable during debugging/tests, leave at
0in production.
REPL Inspect
from sys import set_coroutine_origin_tracking_depth
help(set_coroutine_origin_tracking_depth)
Linked from
Related notes
- tuts/python3/stdlib_module/sys/set_asyncgen_hooks Linked here; links to this page; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/set_int_max_str_digits Linked here; links to this page; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sys/activate_stack_trampoline Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/addaudithook Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/audit Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/breakpointhook Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/call_tracing shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/deactivate_stack_trampoline shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/displayhook shared tags: #stdlib, #sys