gh-142186: all-local PEP-669 events#146182
Conversation
We make the PY_UNWIND monitoring event available as a code-local event to allow trapping on function exit events when an exception bubbles up. This complements the PY_RETURN event by allowing to catch any function exit event.
We make all the events of the low-impact monitoring API local, shifting the distinction to whether they are instrumented or non-instrumented.
d02dc43 to
3b8e1d5
Compare
|
@markshannon apologies for pinging you again, I appreciate you might be busy with other work. I would love for this to land in main before the first beta in May if possible 🙏 |
|
Overall, this looks good in terms of semantics and capabilities. I do have a problem with the naming, though. If we make all events "local", that does make the term "local" rather meaningless and terminology you use such as "instrumented local events" and "non-instrumented local events" is a bit opaque. Also, there is still a clear distinction between the events that can be precisely disabled and those that can only be disabled per code object. So, with that in mind, I think we should still keep the terms "global" and "local" for the events they apply to now, and merely frame the change as "global events can now be turned on and disable on a per-code object basis". In the docs, change "All local events can be disabled" to "All local events can be disabled per location" It is unfortunate the functions Sorry for taking so long to get back to this. It will get into 3.15 |
|
@markshannon many thanks for your review.
I totally agree with this sentiment, however a feature like the low-impact monitoring API sits quite close to the "stripped wires" that it becomes tricky to avoid that. However
so as requested I have made some changes to the wording in the documentation and comments to try and capture this instead. |
We make all the low-impact monitoring API events implemented by PEP-669 local on a per-code object basis. All the events can now be enabled on selected code objects. The distinction is now between instrumented and non-instrumented events, whereby the behaviour of the
DISABLEsentinel value differs. For instrumented events,DISABLEwill remove the instrumentation at the specific code location where the value was returned. For non-instrumented events,DISABLEwill simply disable the event for the whole code object.PY_UNWINDmonitoring event local #142186📚 Documentation preview 📚: https://cpython-previews--146182.org.readthedocs.build/