summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2024-03-13 08:28:01 (GMT)
committerGitHub <noreply@github.com>2024-03-13 08:28:01 (GMT)
commit8332e85b2f079e8b9334666084d1f8495cff25c1 (patch)
tree76244f8c82fa00a35ed92956d09d0b10afcfd6d2 /Lib
parentba82a241ac7ddee7cad18e9994f8dd560c68df02 (diff)
downloadcpython-8332e85b2f079e8b9334666084d1f8495cff25c1.zip
cpython-8332e85b2f079e8b9334666084d1f8495cff25c1.tar.gz
cpython-8332e85b2f079e8b9334666084d1f8495cff25c1.tar.bz2
gh-116626: Emit `CALL` events for all `INSTRUMENTED_CALL_FUNCTION_EX` (GH-116627)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_monitoring.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_monitoring.py b/Lib/test/test_monitoring.py
index 1e77eb6..11fb2d8 100644
--- a/Lib/test/test_monitoring.py
+++ b/Lib/test/test_monitoring.py
@@ -1807,6 +1807,21 @@ class TestRegressions(MonitoringTestBase, unittest.TestCase):
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))
+
class TestOptimizer(MonitoringTestBase, unittest.TestCase):