Skip to content
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

Add support for sys.monitoring events. #9482

Merged
merged 8 commits into from
Apr 26, 2024

Commits on Mar 7, 2024

  1. Add support for sys.monitoring events.

    Python 3.12 introduced a new event monitoring system
    `sys.monitoring`. This patch augments Numba's dispatcher so as to
    emit events associated with a Python function starting and
    returning from execution. Tools monitoring for such events will
    therefore be able to identify execution of Numba's pure machine
    code regions as though they were actual Python functions. This
    allows tools such a ``cProfile`` to record Numba compiled function
    execution and report them as part of their output.
    
    Fixes numba#9289
    stuartarchibald committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    7a19e9a View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2024

  1. Add support for RAISE and PY_UNWIND events.

    Adds support to Numba's dispatcher for the ``sys.monitoring.events``
    of type ``RAISE`` and `PY_UNWIND``. Associated unit tests are added
    and cProfile testing is updated. Docs are updated to match.
    stuartarchibald committed Apr 22, 2024
    Configuration menu
    Copy the full SHA
    4f870eb View commit details
    Browse the repository at this point in the history
  2. Merge 'main' into wip/sys_monitoring

    Resolved conflicts:
    	numba/tests/support.py
    stuartarchibald committed Apr 22, 2024
    Configuration menu
    Copy the full SHA
    88c224a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0899844 View commit details
    Browse the repository at this point in the history

Commits on Apr 24, 2024

  1. Fix cProfile for Python < 3.11 when numba raises.

    If a Numba function is being run under cProfile and the
    function raises an exception, the dispatcher must handle
    this correctly. It is not valid to call
    `PyFrame_FastToLocals` without saving and restoring the
    exception state across the call as it can clear the
    exception state itself. This patch fixes this problem and
    also stops calling `PyFrame_LocalsToFast` in Python 3.11
    where the "whats-new" docs claim that the frames are now
    looked after by the virutal machine.
    stuartarchibald committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    28ca083 View commit details
    Browse the repository at this point in the history
  2. Fix RST syntax in sys.monitoring docs.

    Fixes some RST syntax and a couple of grammatical errors.
    stuartarchibald committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    3a17c60 View commit details
    Browse the repository at this point in the history

Commits on Apr 26, 2024

  1. Workaround potential CPython bug.

    This works around a potential bug in CPython where the state
    associated with a monitoring tool can "leak" in an unexpected
    manner.
    
    This patch also removes the use of the functools cache on the
    generator for test functions, this to eliminate any potential
    state being stored on the code objects associated with the
    test functions.
    stuartarchibald committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    5d652e7 View commit details
    Browse the repository at this point in the history
  2. Fix comment to read more clearly.

    As title.
    stuartarchibald committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    25535b3 View commit details
    Browse the repository at this point in the history