diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2024-03-14 16:23:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 16:23:15 (GMT) |
commit | 56a3c5f7674d65023bf84759b797e603f09a93e3 (patch) | |
tree | 260b76728a138a1e0b6e980b514bc9f2a58c15f3 /Lib | |
parent | fc4d5fdffe3d9829b118232f35ccee61a27392ee (diff) | |
download | cpython-56a3c5f7674d65023bf84759b797e603f09a93e3.zip cpython-56a3c5f7674d65023bf84759b797e603f09a93e3.tar.gz cpython-56a3c5f7674d65023bf84759b797e603f09a93e3.tar.bz2 |
[3.12] gh-116626: Emit `CALL` events for all `INSTRUMENTED_CALL_FUNCTION_EX (GH-116732)
Backport of GH-116627
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_monitoring.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_monitoring.py b/Lib/test/test_monitoring.py index 8eaf581..383bb65 100644 --- a/Lib/test/test_monitoring.py +++ b/Lib/test/test_monitoring.py @@ -1743,3 +1743,18 @@ class TestRegressions(MonitoringTestBase, unittest.TestCase): sys.monitoring.register_callback(0, E.INSTRUCTION, lambda *args: 0) sys.monitoring.set_events(0, E.LINE | E.INSTRUCTION) sys.monitoring.set_events(0, 0) + + def test_call_function_ex(self): + def f(a, b): + return a + b + args = (1, 2) + + call_data = [] + sys.monitoring.use_tool_id(0, "test") + self.addCleanup(sys.monitoring.free_tool_id, 0) + sys.monitoring.set_events(0, 0) + sys.monitoring.register_callback(0, E.CALL, lambda code, offset, callable, arg0: call_data.append((callable, arg0))) + sys.monitoring.set_events(0, E.CALL) + f(*args) + sys.monitoring.set_events(0, 0) + self.assertEqual(call_data[0], (f, 1)) |