Interesting! Some remarks about the proposed API. On Tue, Dec 7, 2021 at 4:58 PM Mark Shannon <mark@hotpy.org> wrote:
There is no change to the language and it adds 7 functions to the sys module, so shouldn't be too intrusive for those of who aren't planning on implementing any of those tools.
Where are event constants defined, like PY_CALL? Would it make sense to add a small module for these event constants and functions? Would it be possible to define enums (rather than simple ints) for these event constants, to ease debugging? sys.get_monitoring_events()->int sys.set_monitoring_events(event_set: int) sys.get_local_monitoring_events(code: CodeType)->int sys.set_local_monitoring_events(code: CodeType, event_set: int) sys.register_monitoring_callback(event: int, func: Callable) sys.insert_marker(code: CodeType, offset: int, marker_id=0: range(256)) sys.remove_marker(code: CodeType, offset: int) For example: monitoring_events.get_events()->int monitoring_events.set_events(event_set: int) monitoring_events.get_local_events(code: CodeType)->int monitoring_events.set_local_events(code: CodeType, event_set: int) monitoring_events.register_callback(event: int, func: Callable) monitoring_events.insert_marker(code: CodeType, offset: int, marker_id=0: range(256)) monitoring_events.remove_marker(code: CodeType, offset: int) monitoring_events.PY_CALL (... other constants ...) Victor -- Night gathers, and now my watch begins. It shall not end until my death.