-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement and document PEP 669. #103082
Comments
Also needs to be added to the "What's new" and the PEP needs to be marked as accepted/final. |
Specific things to document (that aren't clear from the PEP) (from comments by @gvanrossum):
From GVR: "The naming of the CALL and RETURN/RAISE events is a bit confusing -- we have CALL (universal), C_RETURN/PY_RETURN (per language), but then C_RAISE and RAISE -- why isn't the latter PY_RAISE, just for consistency?" There are good reasons for this design, so they should be documented. |
…on (GH-103083) * The majority of the monitoring code is in instrumentation.c * The new instrumentation bytecodes are in bytecodes.c * legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
Turn on branch events for FOR_ITER instructions.
* main: pythongh-103479: [Enum] require __new__ to be considered a data type (pythonGH-103495) pythongh-103365: [Enum] STRICT boundary corrections (pythonGH-103494) pythonGH-103488: Use return-offset, not yield-offset. (pythonGH-103502) pythongh-103088: Fix test_venv error message to avoid bytes/str warning (pythonGH-103500) pythonGH-103082: Turn on branch events for FOR_ITER instructions. (python#103507) pythongh-102978: Fix mock.patch function signatures for class and staticmethod decorators (python#103228) pythongh-103462: Ensure SelectorSocketTransport.writelines registers a writer when data is still pending (python#103463) pythongh-95299: Rework test_cppext.py to not invoke setup.py directly (python#103316)
… CPython (pythonGH-103083) * The majority of the monitoring code is in instrumentation.c * The new instrumentation bytecodes are in bytecodes.c * legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
Seems that this PR (#103083) has broken the tracerefs buildbot: |
See also #103083 (comment) |
…H-103561) Fix shifted field initialization in instrumentation.c
…GH-104387) When monitoring LINE events, instrument all instructions that can have a predecessor on a different line. Then check that the a new line has been hit in the instrumentation code. This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
* main: pythongh-91896: Fixup some docs issues following ByteString deprecation (python#104422) pythonGH-104371: check return value of calling `mv.release` (python#104417) pythongh-104415: Fix refleak tests for `typing.ByteString` deprecation (python#104416) pythonGH-86275: Implementation of hypothesis stubs for property-based tests, with zoneinfo tests (python#22863) pythonGH-103082: Filter LINE events in VM, to simplify tool implementation. (pythonGH-104387) pythongh-93649: Split gc- and allocation tests from _testcapimodule.c (pythonGH-104403) pythongh-104389: Add 'unused' keyword to Argument Clinic C converters (python#104390) pythongh-101819: Prepare _io._IOBase for module state (python#104386) pythongh-104413: Fix refleak when super attribute throws AttributeError (python#104414) Fix refleak in `super_descr_get` (python#104408) pythongh-87526: Remove dead initialization from _zoneinfo parse_abbr() (python#24700) pythongh-91896: Improve visibility of `ByteString` deprecation warnings (python#104294) pythongh-104371: Fix calls to `__release_buffer__` while an exception is active (python#104378) pythongh-104377: fix cell in comprehension that is free in outer scope (python#104394) pythongh-104392: Remove _paramspec_tvars from typing (python#104393) pythongh-104396: uuid.py to skip platform check for emscripten and wasi (pythongh-104397) pythongh-99108: Refresh HACL* from upstream (python#104401) pythongh-104301: Allow leading whitespace in disambiguated pdb statements (python#104342)
Is there any way to get the active exception from a PY_UNWIND event callback? I was hoping the exception would be passed to the callback but it isn't. This was an issue with the old tracer function debugger / profiler support so it's not really a regression, but I was hoping to avoid the work arounds that we used with it. Note the the signature for several of the events aren't specified -- including PY_UNWIND and EXCEPTION_HANDLED. They're easily enough determined (though my guess was wrong for PY_UNWIND), but it would be better if they were documented. |
It looks like returning DISABLE from a handler for an event >= PY_MONITORING_INSTRUMENTED_EVENTS triggers an assert in a debug build. It would probably be better to just ignore a DISABLE return value since anything else can be returned (I think) or mandate that None be returned. If the current behavior is retained, it should be documented. Please let me know if you want me to open separate bugs for this and for other sys.monitoring issues. Otherwise, I'lll add to this bug. |
An exception raised in a EXCEPTION_HANDLED callback triggers an assert in a debug build of 3.12b4. I was using the following incorrect signature for a callback method and registering it as a bound method --
This was my mistake (it was a simple oversight while editing) but it the calling code should handle the exception without crashing. |
It looks like no RAISE event is emitted for a bare raise in an except: clause or at the end of a finally: clause that implicitly reraises an exception. I don't know whether this a problem with the implementation or it should simply be documented that this is to be expected. My use case is to track what exception is active so it's available to an unwind handler. |
@jpe I think opening a new issue for each separable problem will make these easier to track and triage, and less likely they'll fall through the cracks. |
…python#107069) Rename private C API constants: * Rename PY_MONITORING_UNGROUPED_EVENTS to _PY_MONITORING_UNGROUPED_EVENTS * Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS (cherry picked from commit 0927a2b)
…python#107069) Rename private C API constants: * Rename PY_MONITORING_UNGROUPED_EVENTS to _PY_MONITORING_UNGROUPED_EVENTS * Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS
…python#107069) Rename private C API constants: * Rename PY_MONITORING_UNGROUPED_EVENTS to _PY_MONITORING_UNGROUPED_EVENTS * Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS
…heck if an opcode is defined
…f an opcode is defined (#107882)
… instrumented opcode
… instrumented opcode (python#107978)
… instrumented opcode (python#107978)
…ythonGH-107772) (cherry picked from commit 8b515f6) Co-authored-by: Mark Shannon <[email protected]>
…GH-107772) (#108909) GH-103082: Document PEP-669: Low Impact Monitoring for CPython (GH-107772) (cherry picked from commit 8b515f6) Co-authored-by: Mark Shannon <[email protected]>
Is this issue now complete given #107772? |
…0532). (cherry picked from commit 1991694) Co-authored-by: Tian Gao <[email protected]>
Now that PEP 669 is accepted, it needs to be implemented and documented.
Linked PRs
instrumentation.c
#103561The text was updated successfully, but these errors were encountered: