Skip to content

No sys.monitoring RAISE event emitted when exception is re-raised (3.12b4) #106897

Description

@jpe

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.

I mentioned this in #103082 but was encouraged to create a separate bug for it.

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Jul 19, 2023
  2. markshannon commented on Jul 26, 2023

    @markshannon
    Member

    We should emit an event for these cases, as the "exception raised" events, and "exception handled" events should balance.
    There are quite a lot of exception events during unwinding however, so this could be quite noisy.

    For example:

    def func():
        try:
            try:
                1/0
            except:
                raise
        except:
            pass

    generates 3 raise/handled pairs. The obvious 2, plus another for cleanup, which is highly implementation dependent.
    If we generate normal RAISE events it will break sys.settrace, so we need to emit a different event.
    RERAISE is the obvious name.

  3. added 3 commits that reference this issue on Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13only security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions