Skip to content

Commit cf74e04

Browse files
committed
Better support for trace-function switching
line_profiler/_line_profiler.pyx _LineProfilerManager - Renamed from `_ThreadState` - Added init argument and property `set_frame_local_trace` - Added `.__call__()` so that other Python code doesn't crash when it temporarily overrides and restores the `sys` trace callback via `sys.gettrace()` and `sys.settrace()` LineProfiler - Updated docstring - Added init argument and property `set_frame_local_trace` - Renamed: - `_all_thread_states` -> `_managers` - `_thread_state` -> `_manager` python_trace_callback() - Renamed argument `state_` -> `manager_` - Now setting frame's `.f_trace` if entering a frame with the `PyTrace_CALL` event and if `manager_.set_frame_local_trace` is true tests/test_sys_trace.py <General> Fixed lints in some tests @isolate_test_in_subproc Now taking an optional argument `debug` to permit using `pytest` instead of `python` to run the test, which provides more helpful output in case of a failure (but is significantly slower) test_python_level_trace_manipulation() New test for ensuring that `LineProfiler` plays well with Python-level trace-function manipulation via `sys.gettrace()` and `sys.settrace()`
1 parent 3452ff6 commit cf74e04

2 files changed

Lines changed: 342 additions & 82 deletions

File tree

0 commit comments

Comments
 (0)