Interesting! Some remarks about the proposed API.

On Tue, Dec 7, 2021 at 4:58 PM Mark Shannon <m...@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.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/OBL7T7IN6P2YOLMPFPVDCU6JELLOUDOE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to